gi11ies
Programmer
- Mar 26, 2002
- 52
I'm wondering if anyone has any tips on updating a value in a DataTable from a textbox in a DataGrid.
I have my text box value populated in the DataGrid using:
<itemtemplate>
<asp:textbox id="txtQuantity" Width="30" Text='<%#Container.DataItem("Quantity")%>' runat="server"/>
</itemtemplate>
I have a button that when pressed, I would like it to call a routine to update all the rows in the DataTable and DataGrid with the new values entered into the DataGrid, but just cant get it to work.
The Code I have been using, but it fails to work is as follows:
Sub btnUpdate (sender as System.Object, e as System.EventArgs )
objDT = Session("Cart")
Dim dgItem as DataGridItem
For Each objDR In objDT.Rows
objDR("Quantity") = dgItem.FindControl("txtQuantity")
Next
dg.DataBind()
objDT = dg.DataSource
Session("Cart") = objDT
End Sub
Any tips or suggestions on how to do this would be great.
Gillies
I have my text box value populated in the DataGrid using:
<itemtemplate>
<asp:textbox id="txtQuantity" Width="30" Text='<%#Container.DataItem("Quantity")%>' runat="server"/>
</itemtemplate>
I have a button that when pressed, I would like it to call a routine to update all the rows in the DataTable and DataGrid with the new values entered into the DataGrid, but just cant get it to work.
The Code I have been using, but it fails to work is as follows:
Sub btnUpdate (sender as System.Object, e as System.EventArgs )
objDT = Session("Cart")
Dim dgItem as DataGridItem
For Each objDR In objDT.Rows
objDR("Quantity") = dgItem.FindControl("txtQuantity")
Next
dg.DataBind()
objDT = dg.DataSource
Session("Cart") = objDT
End Sub
Any tips or suggestions on how to do this would be great.
Gillies