Get updated values from DataGrid

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Get updated values from DataGrid

    Hi

    I have a DataGrid, with Edit links in each row. The Edit button works, the
    user can change the values. But I can't get updating to work.

    <asp:datagrid id="Content" runat="server" OnUpdateCommand="Content_Update"
    OnCancelCommand="Content_Cancel" OnEditCommand="Content_Edit">
    <Columns>
    <asp:EditCommandColumn EditText="Edit" UpdateText="Update"
    CancelText="Cancel" />
    </Columns>
    </asp:datagrid>

    Sub Content_Update(ByVal sender As Object, ByVal e As
    DataGridCommandEventArgs)
    Dim txt1 As String = CType(e.Item.Cells(2).Controls(0), TextBox).Text
    Dim txt2 As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
    etc.

    My problem is that txt1 and txt2 end up with the original values, not the
    new ones that have been entered by the user. I've looked for a PostBack
    function but there doesn't seem to be one. How can I get the updated values?

    Thanks
    Chris


    Chris Mahoney Guest

  2. Similar Questions and Discussions

    1. Play effect when row updated in DataGrid
      I have a DataGrid that contains N number of rows. When one of the rows is updated I'd like to play some sort of effect to highlight the fact that...
    2. DataGrid: OnUpdateCommand - getting the updated values
      Greeting all, I have been reading a number of posts and all the samples I have seen are the same, yet I can't access the updated values of a...
    3. read row values from datagrid and populate in new datagrid values from connected
      Hello, i am new in asp.net and i am having a question: I am having a datagrid_1 in which i am showing the context of PatientDetails table....
    4. Datagrid not updated during delete, but updated during insert and update
      Hello everyone. A test webform here, single datagrid bound to one table through dataset, and controls to delete, update and insert data. The code...
    5. Missing CODEGEN values from DataSet Web Reference and Properties are not updated
      I've created a web service that has a project reference to a library that contains a strongly typed dataset. The web service has a function that...
  3. #2

    Default Re: Get updated values from DataGrid

    Sorry, I'm an idiot, ignore this :)

    Chris

    "Chris Mahoney" <chris@nzweb.net> wrote in message
    news:uET8MqWvFHA.1988@TK2MSFTNGP10.phx.gbl...
    > Hi
    >
    > I have a DataGrid, with Edit links in each row. The Edit button works, the
    > user can change the values. But I can't get updating to work.
    >
    > <asp:datagrid id="Content" runat="server" OnUpdateCommand="Content_Update"
    > OnCancelCommand="Content_Cancel" OnEditCommand="Content_Edit">
    > <Columns>
    > <asp:EditCommandColumn EditText="Edit" UpdateText="Update"
    > CancelText="Cancel" />
    > </Columns>
    > </asp:datagrid>
    >
    > Sub Content_Update(ByVal sender As Object, ByVal e As
    > DataGridCommandEventArgs)
    > Dim txt1 As String = CType(e.Item.Cells(2).Controls(0), TextBox).Text
    > Dim txt2 As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
    > etc.
    >
    > My problem is that txt1 and txt2 end up with the original values, not the
    > new ones that have been entered by the user. I've looked for a PostBack
    > function but there doesn't seem to be one. How can I get the updated
    > values?
    >
    > Thanks
    > Chris
    >
    >

    Chris Mahoney Guest

  4. #3

    Default Re: Get updated values from DataGrid

    No, you are smart to fingure it out yourself.


    "Chris Mahoney" <chris@nzweb.net> wrote in message
    news:eteZLyWvFHA.724@TK2MSFTNGP14.phx.gbl...
    > Sorry, I'm an idiot, ignore this :)
    >
    > Chris
    >
    > "Chris Mahoney" <chris@nzweb.net> wrote in message
    > news:uET8MqWvFHA.1988@TK2MSFTNGP10.phx.gbl...
    > > Hi
    > >
    > > I have a DataGrid, with Edit links in each row. The Edit button works,
    the
    > > user can change the values. But I can't get updating to work.
    > >
    > > <asp:datagrid id="Content" runat="server"
    OnUpdateCommand="Content_Update"
    > > OnCancelCommand="Content_Cancel" OnEditCommand="Content_Edit">
    > > <Columns>
    > > <asp:EditCommandColumn EditText="Edit" UpdateText="Update"
    > > CancelText="Cancel" />
    > > </Columns>
    > > </asp:datagrid>
    > >
    > > Sub Content_Update(ByVal sender As Object, ByVal e As
    > > DataGridCommandEventArgs)
    > > Dim txt1 As String = CType(e.Item.Cells(2).Controls(0), TextBox).Text
    > > Dim txt2 As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
    > > etc.
    > >
    > > My problem is that txt1 and txt2 end up with the original values, not
    the
    > > new ones that have been entered by the user. I've looked for a PostBack
    > > function but there doesn't seem to be one. How can I get the updated
    > > values?
    > >
    > > Thanks
    > > Chris
    > >
    > >
    >
    >

    Elton Wang Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139