Wednesday, August 18, 2010

How can I combine an image button with a text property in ASP.NET?

I currently have a image button that has the text as part of the image. This does not work good when I adjust the size in the browser. So I want to make the text as actual text and not an image on it. But image button does not have a text property (duh) and the button control does not allow fancy looks or images for background colors. Any help is appreciated. How can I combine an image button with a text property in ASP.NET?
You will need to use both an image button and a Link button. The image button on its own will not suffice.





Hope this works.How can I combine an image button with a text property in ASP.NET?
You don't even need code behind...Just use this code....It basically hides the default button appearance so you can put the text on there. I even added some mouse over events for you. Should get you started.





Goodluck





For some reason yahoo truncates the text..the line that ends with ';.clas...'; is supposed to say ';className';





%26lt;script type=';text/javascript';%26gt;


//ADD BORDERS ON THE MOUSE OVER EVENT AND CHANGE THE CURSOR


function OnMouseOver()


{


document.getElementById('spanMain').clas鈥?= 'spanHover';


}


function OnMouseOut()


{


document.getElementById('spanMain').clas鈥?= 'spanNormal';


}


%26lt;/script%26gt;


%26lt;style type=';text/css';%26gt;


.spanNormal,


.spanHover,


.spanGeneric


{


background-image:url('SomeImage.jpg');


background-repeat:no-repeat;


height:26px;


}


.spanNormal


{


border:solid 3px transparent;


}


.spanHover


{


border: solid 3px DarkGray;


cursor:pointer;


}


%26lt;/style%26gt;





%26lt;span id=';spanMain'; onmouseover=';OnMouseOver()'; onmouseout=';OnMouseOut()'; class=';spanNormal';%26gt;


%26lt;asp:Button BackColor=';Transparent'; BorderColor=';Transparent'; BorderStyle=';None'; ID=';btnText'; runat=';server'; Width=';75px'; Height=';20px'; Font-Bold=';true'; Font-Size=';15px'; Text=';YourText'; /%26gt;


%26lt;/span%26gt;
  • horses for loan
  • skin care
  • No comments:

    Post a Comment