how to get the edit mode in c# dot net datagridview
kannan T
Hi Kannnan I think this is this the best for u
http://www.c-sharpcorner.com/UploadFile/raj1979/GridViewExample11232008075052AM/GridViewExample.aspx
To get edit mode in c# .net datagridview write the following code.
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; bindgrid(); }
void bindgrid() { cn = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ConnectionString); cn.Open(); SqlCommand cmd = new SqlCommand("select * from stud", cn); // stud is a table name. SqlDataReader dr = cmd.ExecuteReader(); GridView1.DataSource = dr; GridView1.DataBind(); }