向 asp.net 按钮添加 fontawesome 图标

New*_*ail 5 c# asp.net twitter-bootstrap font-awesome font-awesome-5

我正在使用 gridview 来显示数据,在 gridview 本身中我有一些操作按钮,如编辑删除和预览图片视图。但我不想在我的预览按钮上显示文本“预览”,我想要(fontawesome 图标)而不是文本(预览)。我的代码在这里......

<asp:GridView ID="GVProduct" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CssClass="table table-bordered table-sm table-hover table-striped" EmptyDataText="No rows  for the selection criteria." EnableTheming="False" PageSize="5" OnRowCommand="grdForRows_RowCommand" OnPageIndexChanging="grdForRows_PageIndexChanging">
<Columns>
    <asp:BoundField DataField="ProId" HeaderText="Prod.Id">
        <HeaderStyle HorizontalAlign="Left" />
        <ItemStyle HorizontalAlign="Right" />
    </asp:BoundField>
    <asp:BoundField DataField="ProName" HeaderText="Product Name">
        <HeaderStyle HorizontalAlign="Left" />
        <ItemStyle HorizontalAlign="Left" />
    </asp:BoundField>
    <asp:BoundField DataField="ProCategory" HeaderText="Category">
        <HeaderStyle HorizontalAlign="Left" />
        <ItemStyle HorizontalAlign="Left" />
    </asp:BoundField>
    <asp:ButtonField Text="Preview" ButtonType="Button" HeaderText="Photo" CommandName="btnPreview">
        <ControlStyle CssClass="btn btn-success btn-sm" />
    </asp:ButtonField>
    <asp:ButtonField Text="Edit" ButtonType="Button" CommandName="btnEdit">
        <ControlStyle CssClass="btn btn-primary btn-sm" />
    </asp:ButtonField>
    <asp:ButtonField ButtonType="Button" CommandName="btnDelete" Text="Delete">
        <ControlStyle CssClass="btn btn-danger btn-sm" />
    </asp:ButtonField>
</Columns>
Run Code Online (Sandbox Code Playgroud)

我想在按钮上添加的图标的代码是

<i class="fas fa-eye"></i>
Run Code Online (Sandbox Code Playgroud)

sub*_*a46 -2

您可以使用图像
DeleteImageUrl =“~/images/remove.png”

这是一种有效的方法,我不知道为什么有人给予负面评价

<asp:CommandField ButtonType="Image" ShowDeleteButton="True" HeaderStyle-BackColor="LightBlue" DeleteImageUrl="~/images/remove.png" ItemStyle-Width="2%"></asp:CommandField>
Run Code Online (Sandbox Code Playgroud)