I want to save the textbox value in a gridview row before updating. The value After I click editing before making any change and updating.
But I got an exception:
Object reference not set to an instance of an object.
my code is here:
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
TextBox tb1 = (TextBox)GridView1.Rows[GridView1.EditIndex].FindControl("TextBox1");
Label user = (Label)GridView1.Rows[GridView1.EditIndex].FindControl("LabelUser");
if (!String.IsNullOrEmpty(tb1.Text))
{
Session["Note"] = tb1.Text;
}
else
Session["Note"] = null;
if (!String.IsNullOrEmpty(user.Text))
{
Session["User"] = user.Text;
}
else
Session["User"] = null;
BindData();
}
the textboxes in the row I am going to edit m ...
Go to the complete details ...