Search code examples
asp.netskincommandfield

ASP.NET CommandField & skin


I'm tying to skin ASP.NET GridView CommandField. Everything si working fine, just when I move CommandField property declarations from page to skin file, the whole commandField properties are ignored. here is my skin file:

<asp:GridView 
AllowPaging="true" 
AllowSorting="false" 
AutoGenerateEditButton="false" 
AutoGenerateDeleteButton="false" 
AutoGenerateSelectButton="false" 
AutoGenerateColumns="false" 
GridLines="None" 
PageSize="20" 
ShowFooter="false" 
ShowHeader="true" 
runat="server"> 
<Columns> 

<asp:CommandField 
ButtonType="Image" 
ControlStyle-Width="25" 
EditImageUrl="Images/Icons/pencil.png" 
DeleteImageUrl="Images/Icons/cross.png" 
/> 

</Columns> 
</asp:GridView> 

In web.config I apply only StyleSheetTheme. Do I miss something?

Thanks


Solution

  • If you want to use a Fontawesome icon, you can change it like that:

    <asp:CommandField ButtonType="Link" ShowEditButton="true"
    EditText="<i class='fas fa-edit'></i>" />
    

    for Delete use:

    DeleteText="<i class='fas fa-trash-alt'></i>"
    

    for Canel use:

    CancelText="<i class='fas fa-window-close'></i>"
    

    for Update use:

    UpdateText="<i class='fas fa-sync'></i>"