---
title: "Gridview show edit button"  
description: "Gridview show edit button"  
author: "Anonymous User"  
published: 2014-08-23  
updated: 2014-08-23  
canonical: https://www.mindstick.com/forum/2104/gridview-show-edit-button  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Gridview show edit button

I’m having some [issues](https://www.mindstick.com/articles/12944/mattresses-for-kids-and-mothers-should-meet-certain-criteria-issues-you-should-consider) with the edit [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) inside a [gridview](https://www.mindstick.com/articles/873/update-delete-edit-gridview-in-asp-dot-net). When you [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) edit in the gridview, the [cancel](https://answers.mindstick.com/qa/94501/how-can-i-cancel-my-singapore-flight-ticket) button gets the same css [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) as the edit button. So my cancel button gets the same edit [icon](https://www.mindstick.com/articles/13090/icon-the-identity-of-your-brand).

I want to change this so that the cancel button gets a different css-class. So I can give it the [right](https://www.mindstick.com/articles/12766/check-whether-you-are-doing-digital-transformation-right-or-not) icon instead of an edit icon

<asp:CommandField ShowEditButton="[True](https://yourviews.mindstick.com/view/81326/boycott-chinese-products-dream-will-come-true)" ButtonType="Button" ControlStyle-[CssClass](https://www.mindstick.com/forum/12787/how-to-get-access-to-cssclass-property-for-server-element-isn-t-webcontrol-in-asp-dot-net)="edit-sprite"></asp:CommandField>

## Replies

### Reply by Sumit Kesarwani

Hi Jeet,

You could use TemplateFields instead of CommandFields:

```
    
<asp:TemplateField ShowHeader="False">       
<ItemTemplate>           
<asp:LinkButton ID="EditButton" runat="server"                           
CssClass="EditButton"                           
CommandName="Edit"                            
Text="Edit" />       
</ItemTemplate>       
<EditItemTemplate>           
<asp:LinkButton ID="UpdateButton"  runat="server"                        
   CssClass="UpdateButton"                           
CommandName="Update"                           
Text="Update" />&nbsp;           
<asp:LinkButton ID="Cancel"                           
runat="server"                           
CssClass="CancelButton"                           
CommandName="Cancel"                           
Text="Cancel" />       
</EditItemTemplate>      
</asp:TemplateField>      
<asp:TemplateField>        
<ItemTemplate>          
<asp:LinkButton ID="DeleteButton"  CssClass="DeleteButton"                       
Text="Delete"                       
CommandName="Delete"                        
runat="server" />        
</ItemTemplate>    
</asp:TemplateField>
```


---

Original Source: https://www.mindstick.com/forum/2104/gridview-show-edit-button

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
