Editing in Datagrid with ASP.NET
Hi,
I am copying an example from a wrox book to learn editing in datagrid
When I refer to the textbox controls that the user as edited in my event handler I am not getting the edited text but the original values before editing.
Here is my event handler
Public Sub DoItemUpdate(ByVal objSource As Object, ByVal objArgs As DataGridCommandEventArgs)
Dim objF, objL, objC As TextBox
objF = CType(objArgs.Item.FindControl("txtFirstName"), TextBox)
objL = CType(objArgs.Item.FindControl("txtLastName"), TextBox)
objC = CType(objArgs.Item.FindControl("txtCity"), TextBox)
Dim strSQL As String
strSQL = "UPDATE Employees SET FirstName = '" & objF.Text & "',"
strSQL += " Lastname = '" & objL.Text & "',"
strSQL += " City = '" & objC.Text & "'"
strSQL += " WHERE EmployeeID = " & MyDataGrid.DataKeys(objArgs.Item.ItemIndex)
ExecuteSQLStatement(strSQL)
MyDataGrid.EditItemIndex = -1
BindDataGrid()
End Sub
Can anyone suggest why this is so?
Btw when I enbable tracing I can see the controls with there new values.
rotsey
|