How to delete a row from grid view using connectivity code.
con = new SqlConnection("Data Source=SPICOM15-PC;Initial Catalog=Student;Integrated Security=True;Pooling=False");
Label lblstid = (Label)GridView1.Rows[e.RowIndex].FindControl("lblId");
TextBox txtname = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtname");
TextBox txtclassname = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtcity");
TextBox txtemailid = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtEmailId");
cmd.Connection = con;
cmd.CommandText = "Update Information set Id='" + txtid.Text + "',Name='" + txtname.Text + "',City='" + txtcity.Text + "',EmailId='" + txtemailid.Text + "' where Id='" + txtid.Text + "'";
cmd.Connection.Open();
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
BindData();
con.Close();
How to set column name as in the line Label lblstid = (Label)GridView1.Rows[e.RowIndex].FindControl("lblId");