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:
  1. dt.Rows(row.DataItemIndex)("client") = (CType((row.Cells(4).Controls(0)), TextBox)).Text

current code

vb Code:
  1. Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs)
  2.         '  Dim GridView1 As GridView
  3.  
  4.         Dim GridView1 As GridView = TryCast(LoginView1.FindControl("GridView1"), GridView)
  5.         GridView1.EditIndex = e.NewEditIndex
  6.  
  7.  
  8.     End Sub
  9.  
  10.     Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs)
  11.         Dim GridView1 As GridView = TryCast(LoginView1.FindControl("GridView1"), GridView)
  12.  
  13.         GridView1.PageIndex = e.NewPageIndex
  14.        
  15.     End Sub
  16.     Private Sub BindData()
  17.         Dim GridView1 As GridView = TryCast(LoginView1.FindControl("GridView1"), GridView)
  18.  
  19.         GridView1.DataSource = Session("trackmain")
  20.         GridView1.DataBind()
  21.     End Sub
  22.  
  23.     Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs)
  24.         Dim GridView1 As GridView = TryCast(LoginView1.FindControl("GridView1"), GridView)
  25.  
  26.         GridView1.EditIndex = -1
  27.  
  28.     End Sub
  29.  
  30.     Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs)
  31.         Dim GridView1 As GridView = TryCast(LoginView1.FindControl("GridView1"), GridView)
  32.  
  33.         Dim dt = CType(Session("trackmain"), DataTable)
  34.  
  35.         'Update the values.
  36.         Dim row = GridView1.Rows(e.RowIndex)
  37.         dt.Rows(row.DataItemIndex)("client") = (CType((row.Cells(4).Controls(0)), TextBox)).Text
  38.  
  39.         GridView1.EditIndex = -1
  40.  
  41.  
  42.     End Sub
  43. End Class

thanks