web程式中datagrid更新不成的问题
这是web程式中修改数据行后更新的过程,程式执行通过,但是数据没有更新,好象是str1取得的数据没有变,是更新以前各列的值的,不知问题出在哪里?请各位指点(小弟以前是写WINFORM的,对WEB不熟识。)
Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.UpdateCommand
Dim editrownumber As Integer
Dim i As Integer
Dim inputcontrol As TextBox 'Object
editrownumber = DataGrid1.EditItemIndex
Dim rowindex As Integer
Dim myrow As DataRow
rowindex = editrownumber + DataGrid1.CurrentPageIndex * DataGrid1.PageSize
myrow = mytable.Rows(rowindex)
Dim str1 As String
For i = 2 To e.Item.Cells.Count - 1
inputcontrol = e.Item.Cells(i).Controls(0)
str1 = inputcontrol.Text
myrow(i - 2) = str1
' Stop
Next
DataGrid1.EditItemIndex = -1
DataGrid1.DataSource = mytable
DataGrid1.DataBind()
End Sub