i got an error here in below line of code :
Dim tempID As String = DirectCast(grdMaster.Rows(e.RowIndex).FindControl("tempID"), Label).Text
ERROR IS : System.NullReferenceException: Object reference not set to an instance of an object.
my code is :
Protected Sub grdMaster_rowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles grdMaster.RowUpdating
Dim conStr As String = ConfigurationManager.ConnectionStrings("conStr").ConnectionString
Dim con1 As SqlConnection = New SqlConnection(conStr)
Dim tempID As String = DirectCast(grdMaster.Rows(e.RowIndex).FindControl("tempID"), Label).Text
Dim grpName As String = DirectCast(grdMaster.Rows(e.RowIndex).FindControl("group"), TextBox).Text
Dim usrName As String = DirectCast(grdMaster.Rows(e.RowIndex).FindControl("user"), TextBox).Text
Dim str As String = "update MMM_REF_GROUP_USER set grpId=@groupId, usrId=@userId where tempID=@tempId "
Dim cmd As SqlCommand = New SqlCommand(str, con1)
cmd.Parameters.Add("@tempId", SqlDbType.Int).Value = tempID
cmd.Parameters.Add("@grpId", SqlDbType.NVarChar).Value = grpName
cmd.Parameters.Add("@usrId", SqlDbType.NVarChar).Value = usrName
grdMaster.EditIndex = -1
grdMaster.DataSource = GetDataItem(cmd)
grdMaster.DataBind()
End Sub