将图像添加到asp.net中的链接按钮

Mar*_*ark 13 c# asp.net

<asp:GridView ID="Grid_Organisationtable" runat="server"  CssClass="string"
             SelectedIndex="0" DataKeyNames="OrganisationID"
            ShowHeaderWhenEmpty="True" OnRowDeleting="Grid_Organisationtable_RowDeleting" OnRowEditing="Grid_Organisationtable_RowEditing"
            AutoGenerateColumns="false" Height="95px" Width="492px">     
<Columns>
                   <asp:TemplateField HeaderText="Edit Controls" ItemStyle-Width="15%">
                        <ItemTemplate>
                            <asp:ImageButton ImageUrl="~/Styles/Images/Edit.jpg" CommandName="Edit" runat="server"
                                ID="btn_Edit" ToolTip="Edit Organisation" />
     <asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("OrganisationID") %>' CommandName="Delete" runat="server">delete</asp:LinkButton>
     </ItemTemplate>
                        <ItemStyle Width="15%" />
                    </asp:TemplateField>
Run Code Online (Sandbox Code Playgroud)

我在网格视图中有一个链接按钮从网格中删除一行,我想将图像添加到链接按钮而不是文本删除.如何将图像添加到链接按钮.我不想使用图像按钮.谢谢.

Dav*_*vid 29

在标签之间放置一个标签

<asp:LinkButton>
Run Code Online (Sandbox Code Playgroud)

</asp:LinkButton>
Run Code Online (Sandbox Code Playgroud)

标签,就像你普通的超链接一样.

 <asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("OrganisationID") %>' CommandName="Delete" runat="server"><img src="pathtoimage.jpg" alt="delete group" />delete</asp:LinkButton> 
Run Code Online (Sandbox Code Playgroud)

  • 不,工具提示是"标题"属性:P (2认同)

Jam*_*son 13

这不起作用吗?:

<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("OrganisationID") %>' CommandName="Delete" runat="server">
    <asp:Image ID="Image1" runat="server" ImageUrl="/images/someimage.jpg" style="border-width: 0px;" />
</asp:LinkButton> 
Run Code Online (Sandbox Code Playgroud)