Hello,
Please use this code in row updating event below..
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
int id = Int32.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
string tname = ((TextBox)row.Cells[0].Controls[0]).Text;
string tques = ((TextBox)row.Cells[1].Controls[0]).Text;
MySqlCommand cmd = new MySqlCommand("update exam set name1=@name,ques=@ques where id = @id", con);
cmd.Parameters.Add("@id", MySqlDbType.Int16).Value = id;
cmd.Parameters.Add("@name", MySqlDbType.VarChar, 30).Value = tname.Text.Trim();
cmd.Parameters.Add("@ques", MySqlDbType.VarChar, 40).Value = tques.Text.Trim();
con.Open();
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
bind();
}
if you get result then pls give vote for answer..