<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>
I am having a link button in the grid view to delete a row from the grid, I want to add a image to the link button instead of the text delete. how can I add image to the link button. I dont want to use image button. Thanks.
Place an tag in between the
<asp:LinkButton>
and
</asp:LinkButton>
tags, just like you would a normal hyperlink.
<asp:LinkButton ID="LinkButton1" CommandArgument='<%# Eval("OrganisationID") %>' CommandName="Delete" runat="server"><img src="pathtoimage.jpg" alt="delete group" />delete</asp:LinkButton>
Will this not work?:
<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>
I didn't use text property of link button and did this:
<asp:LinkButton ID="lbtag" runat="server" CausesValidation="false">
<asp:Image ID="imgdelete" runat="server" ImageUrl="images/delete.jpg" />
<%# Container.DataItem %>
</asp:LinkButton>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With