Protected void Update(object sender, GridViewCommandEventsArg e)
{
if(e.CommandName == "Change")
{
int index = GridViewemp.EditIndex;
GridViewRow grid = GridViewemp.Rows[index];
TextBox salary = (TextBox)GridViewemp.FindControl("TextBoxsalary");
sqlcon.Open();
string query = "Update Employee set Salary="+salary.Text+"where EmpID ="+GridViewemp.SelectedDataKey.Value.ToString();
sqlcom = new SqlCommand(query, sqlcon);
sqlcom.ExecuteNonQuery();
sqlcon.Close();
}
}
I am getting the error Error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
Please help me to get the value from TextBoxsalary