My client wanted the GridView to display fields inside TextBoxes, and DropDownListBoxes only. He wanted the flexibility to update the Record just by clicking on the Update button after altering the values in the cell.
He wanted the current editing GridViewRow in some different color so that he can click on "Update" button for that particular row.
How can I identify the current editing row in the GridView? Since there is no edit button to click on!!
Probably you are looking for
Also here is tutorial which looks like fit your problem: http://csharpdotnetfreak.blogspot.com/2009/05/gridview-sqldatasource-insert-edit.html
Based on Gridview rows EditItemIndex you can find whether a row is in Edit mode or not. Refer to this to know more.
you can select the Row by using this code,And show the Row with different color. u can highlight,
protected override void Render(System.Web.UI.HtmlTextWriter writer)
private void AddRowSelectToGridView(GridView gv)
foreach (GridViewRow row in gv.Rows)
row.Attributes["onmouseover"] = "this.style.cursor='hand';
row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
catch (Exception ex)
Are you talking a multi-line edit? Or a scenario where all rows show their editable UI? The best way, if this is the case, is to use TemplateFields for all fields, and render the textboxes/other controls in the template. Out of the box, multi-row editing is not supported.
Or you can create a custom control like what was done here: http://blogs.msdn.com/b/mattdotson/archive/2005/11/09/real-world-gridview-bulk-editing.aspx
If you are talking simply editing, selecting the AutoGenerateUpdateButton="true" will add an update button, or manually add a commandfield and set its CommandName to update.