Search code examples
asp.netlinkbuttonimagebutton

how to display the text on ImageButton


how to display the text on ImageButton. or how to have a linkbutton on Image

I have tried this:

 <asp:LinkButton ID="lbYear" runat="server" CausesValidation="false" Text="HOME">
    <asp:Image ID="Image1" runat="server" ImageUrl="~/images/menu.png" Width="90px" Height="39px" />
 </asp:LinkButton>

but it is showing the text above the Image..


Solution

  • It seems like you're actually in need of <asp:ImageButton />, which is basically an Image and LinkButton control wrapped into one:

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.imagebutton.aspx

    Richard.