views:

56

answers:

1

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..

A: 

Hello

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.

Richard
thanks for yr reply ..but i cannot able to have a text over that imagebutton
Ranjana
That's true, the ImageButton control won't support that out of the box. But, if you absolutely must have the text you want actually form part of the image (i.e. the image and text appear as one single image) then you can create your own ImageButton control which inherits from ImageButton, and use the System.Drawing namespace to directly manipulate the image. That is, of course, assuming you can't use some clever CSS/HTML to achieve the same effect. It all depends what you need and how you need to do it...
Richard