Results 1 to 2 of 2

Thread: updateCommand of datagrid

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471

    updateCommand of datagrid

    hi,

    Do you know hwo to get the changed value out of the datagrid?
    I did the code like this to get the changed name, but it still gave me the old value.

    Dim namebox As TextBox
    namebox = CType(e.Item.Cells(1).Controls(0), TextBox)

    Dim name As String = e.Item.Cells(1).Text

  2. #2
    Addicted Member Halon's Avatar
    Join Date
    Oct 2002
    Location
    under desk choking on rage
    Posts
    228
    i use this
    VB Code:
    1. Public Sub DataGrid_Update(ByVal Source As Object, ByVal E As DataGridCommandEventArgs)
    2. Dim sheets As Integer
    3. sheets = CType(E.Item.FindControl("txtSheets"), TextBox).Text

    where i have this in the html of the datagrid

    VB Code:
    1. <asp:TemplateColumn HeaderText="Sheets Printed">
    2. <HeaderStyle ForeColor="#FF0000"></HeaderStyle>
    3. <ItemStyle ForeColor="#FF0000"></ItemStyle>
    4. <ItemTemplate>
    5. <asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SheetsPrinted") %>'>
    6. </asp:Label>
    7. </ItemTemplate>
    8. <EditItemTemplate>
    9. <asp:TextBox runat="server" id="txtsheets" columns="3" Text='<%# DataBinder.Eval(Container, "DataItem.SheetsPrinted") %>'>
    10. </asp:TextBox>
    11. </EditItemTemplate>

    I am using a template column but the same basic theory applies to a bound column. Hope it helps.
    Soylent Green tastes like chicken

Posting Permissions

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



Click Here to Expand Forum to Full Width