Click to See Complete Forum and Search --> : updateCommand of datagrid
Palmtree
Nov 19th, 2002, 12:26 PM
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
Halon
Nov 26th, 2002, 05:16 PM
i use this
Public Sub DataGrid_Update(ByVal Source As Object, ByVal E As DataGridCommandEventArgs)
Dim sheets As Integer
sheets = CType(E.Item.FindControl("txtSheets"), TextBox).Text
where i have this in the html of the datagrid
<asp:TemplateColumn HeaderText="Sheets Printed">
<HeaderStyle ForeColor="#FF0000"></HeaderStyle>
<ItemStyle ForeColor="#FF0000"></ItemStyle>
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SheetsPrinted") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="txtsheets" columns="3" Text='<%# DataBinder.Eval(Container, "DataItem.SheetsPrinted") %>'>
</asp:TextBox>
</EditItemTemplate>
I am using a template column but the same basic theory applies to a bound column. Hope it helps. :D
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.