Hi
If we have the following code, then when user clicks an Edit button, page is posted back and put into Edit mode:
protected void gvwEmployees_RowEditing(object sender, GridViewEditEventArgs e)
{
gvwEmployees.EditIndex = e.NewEditIndex;
gvwEmployees.DataSource = ds.Tables["Employees"];
gvwEmployees.DataBind();
}
But with the following code, user has to click the Edit button twice before a row is put into edit mode ( thus page needs to be posted back twice before row gets into edit mode). Why does it matter whether gvwEmployees.EditIndex is assigned a value before or after we bind GridView to a data source?
protected void gvwEmployees_RowEditing(object sender, GridViewEditEventArgs e)
{
gvwEmployees.DataSource = ds.Tables["Employees"];
gvwEmployees.DataBind();
gvwEmployees.EditIndex = e.NewEditIndex;
}
Thank you