Hi,
I changed some line of code.... and using this code, i'm able to see the edit mode gridview but i have to click twice the button to go to the edit mode and the edit textboxes are blank.
Still even when it's blank i tried to edit rows value i get the following error
Code:
Object reference not set to an instance of an object.
at this line
vb Code:
dt.Rows(row.DataItemIndex)("client") = (CType((row.Cells(4).Controls(0)), TextBox)).Text
current code
vb Code:
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs)
' Dim GridView1 As GridView
Dim GridView1 As GridView = TryCast(LoginView1.FindControl("GridView1"), GridView)
GridView1.EditIndex = e.NewEditIndex
End Sub
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs)
Dim GridView1 As GridView = TryCast(LoginView1.FindControl("GridView1"), GridView)
GridView1.PageIndex = e.NewPageIndex
End Sub
Private Sub BindData()
Dim GridView1 As GridView = TryCast(LoginView1.FindControl("GridView1"), GridView)
GridView1.DataSource = Session("trackmain")
GridView1.DataBind()
End Sub
Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs)
Dim GridView1 As GridView = TryCast(LoginView1.FindControl("GridView1"), GridView)
GridView1.EditIndex = -1
End Sub
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs)
Dim GridView1 As GridView = TryCast(LoginView1.FindControl("GridView1"), GridView)
Dim dt = CType(Session("trackmain"), DataTable)
'Update the values.
Dim row = GridView1.Rows(e.RowIndex)
dt.Rows(row.DataItemIndex)("client") = (CType((row.Cells(4).Controls(0)), TextBox)).Text
GridView1.EditIndex = -1
End Sub
End Class
thanks