try
{
int Id = int.Parse(gd.Rows[e.RowIndex].Cells[1].Text);
TextBox txt_sn = gd.Rows[e.RowIndex].Cells[2].Controls[0] as TextBox;
con.Open();
string query = string.Format("Update registration set Studentname where Studentid='{0}'", txt_sn.Text);
SqlCommand cmd = new SqlCommand();
cmd.CommandText = query;
cmd.Connection = con;
}
// string Studentname = ((TextBox)gd.Rows[e.RowIndex].FindControl("txt_sn1")).Text;
catch (Exception ee)
{
Response.Write(ee.Message);
}
finally
{
con.Close();
}
here is my code for gridview to update using boundfeild in asp.net and above related code in c# but im getting an error
Input string was not in a correct format. 1
Object reference not set to an instance of an object. 2