Here is the code to update the perticular field of the gridview
Protected Sub UpdateTDetails(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs)
Try
Dim LblID As Integer = DirectCast(GridViewTDetalis.Rows(e.RowIndex).FindControl("lblID"), Label).Text
Dim txtfuncobj As String = DirectCast(GridViewTDetalis.FooterRow.FindControl("txtfuncobj0"), TextBox).Text
Dim txtmeasuredvar As String = DirectCast(GridViewTDetalis.FooterRow.FindControl("txtmeasuredvar0"), TextBox).Text
Dim txtdeadline As String = DirectCast(GridViewTDetalis.FooterRow.FindControl("txtdeadline0"), TextBox).Text
Dim txtweight_fact As String = DirectCast(GridViewTDetalis.FooterRow.FindControl("txtweight_fact0"), TextBox).Text
Dim con As New SqlConnection(strConnString)
Dim cmd As New SqlCommand()
cmd.CommandType = CommandType.Text
cmd.CommandText = "update MBO_Details set MBO_FUNC_OBJ=@func_obj,MBO_MEASURED_VAR=@mesrd_var,MBO_DEADLINE=@tar_dt,MBO_WEIGHT_FACT=@wt_fact where id=@idnum;" _
& "select id, MBO_EMP_CODE,MBO_FUNC_OBJ, MBO_MEASURED_VAR, MBO_DEADLINE,MBO_WEIGHT_FACT from MBO_Details where MBO_EMP_CODE='40000001'"
cmd.Parameters.Add("@idnum", SqlDbType.VarChar).Value = LblID
cmd.Parameters.Add("@func_obj", SqlDbType.VarChar).Value = txtfuncobj
cmd.Parameters.Add("@mesrd_var", SqlDbType.VarChar).Value = txtmeasuredvar
cmd.Parameters.Add("@tar_dt", SqlDbType.VarChar).Value = txtdeadline
cmd.Parameters.Add("@wt_fact", SqlDbType.VarChar).Value = txtweight_fact
GridViewTDetalis.EditIndex = -1
GridViewTDetalis.DataSource = GetDataTDetails(cmd)
GridViewTDetalis.DataBind()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
but gets the error message
"Object reference not set to an instance of an object."
what will the problem ?