Helo, i want to update Gridview Asp.net using C# Date not Updated please Help
///Gridview///
onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing"
onrowupdating="GridView1_RowUpdating" onrowupdated="GridView1_RowUpdated">
///GridView Updating Code///
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
String ID = GridView1.Rows[e.RowIndex].Cells[0].Text;
String ClassName = GridView1.Rows[e.RowIndex].Cells[1].Text;
obj.con.Open();
obj.qry = "update Classreg set ClassName=@ClassName where ID=@ID";
obj.cmd = new SqlCommand(obj.qry, obj.con);
obj.cmd.Parameters.AddWithValue("ClassName", TextBox2.Text);
obj.cmd.Parameters.AddWithValue("ID", TextBox1.Text);
obj.cmd.ExecuteNonQuery();
obj.con.Close();
Response.Write(@"");
filldata();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
filldata();
}
7 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Feb 27, 2017, 8:33 AM
Rafnas T PPosted Feb 27, 2017, 7:00 AM
Posted Feb 27, 2017, 6:43 AM
Rafnas T PPosted Feb 27, 2017, 5:36 AM
Amit GuptaPosted Feb 27, 2017, 5:10 AM
Posted Feb 27, 2017, 5:05 AM
Amit GuptaPosted Feb 27, 2017, 4:45 AM