1

I am trying to add a Delete function to the records in my ASP.NET GridView control.

I want to have a font-awesome trash icon which will execute the Delete function on click but I am having trouble getting it to display.

Here is my template field:

        <asp:TemplateField HeaderText="Delete?">
            <ItemTemplate>
                <!--Text="Delete" 
                    <i style="font-size:24px" class="fa"  onclick="Delete" runat="server">&#xf014;</i>
                    <i class="fa fa-trash-o">
                    -->
                <span onclick="return confirm('Are you sure to delete?')">                        
                    <button ID="lnkDelete" 
                            runat="server" 
                            ItemStyle-CssClass="fa fa-trash-0"
                            fontsize="24px" 
                            CommandName="Delete"/>
                </span>
            </ItemTemplate>
        </asp:TemplateField>

but after I deploy my Solution and refresh, I get this:

enter image description here

and I want something like this (but with just the Trash icon) enter image description here

so what's the right way to do this?

Our Man in Bananas
  • 5,809
  • 21
  • 91
  • 148

0 Answers0