How do I use images instead of text for AutoGenerateEditButton in ASP.Net GridView -


I am using AutoGenerateEditButton and choose Delete and also people.

I want to

I do not want to manually make the command column because autogrenate properties are used extensively, the project is working on me.

The easiest way to do this is to handle it all by itself Here's a quick example by using ImageButton :

  & asp: GridView id = "yourGrid" runat = "server" OnRowEditing = "yourGrid_RowEditing" & Gt; & Lt; Columns & gt; & Lt; ASP: TemplateField & gt; & Lt; ItemTemplate & gt; & Lt; Asp: ImageButton id = "yourEditButton" runat = "server" CommandName = "edit" ImageUrl = "edit.jpg" /> & Lt; / ItemTemplate & gt; & Lt; EditItemTemplate & gt; & Lt ;! - Your edit control here - & gt; & Lt; / EditItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; / Column & gt; & Lt; / ASP: GridView & gt;  

For now the code behind:

  Protected Zero your grid_rov edit (object sender, gridview and avenues e) {// you just have your grid Can and ignore the sender casting but it generates generic codes for the reuse of the gridview grid = (gridview) sender; Grid.EditIndex = e.NewEditIndex; BindData (); // Restart the edit index once it has been set. }  

This pretty much changes the auto-generated edit button with a ImageButton by setting CommandName to edit it Auto generated will speed up the exact same event as the editing button. This will also apply to deletion, updates, etc. ...


Comments