Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

any way to make button text multi-line ?

Status
Not open for further replies.

millerk

Programmer
Jul 5, 2002
133
US
I have a button that needs to have a caption with 3 words in it. Is there a way to make it multi-line like this:
____________________
| Edit |
| Selected Solution |
|____________________|

In VB6, this happened automatically if the text was too long to fit horizontally within the button. But in ASP.Net, I haven't found a way to keep it from just cutting off the text if it is too long to fit horizontally.

Any ideas?

Thanks

 
The spacing on my pipes got messed up, but you can see what I mean.
 
Not with a native asp:Button, no, because it maps to an HTML submit button. However, you can do it w/ a regular button. ex:
Code:
<BUTTON id="btnWrap" type="button" runat="server">
	<div style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; WIDTH: 70px; PADDING-TOP: 0px; HEIGHT: 48px; WORD-WRAP: break-word"
		width="100%">this is a button with some really long text</div>
</BUTTON>

You could play around with those styles to get it to work. Only problem is that it's not a server control, but that may not be an issue depending on what you need it for. In all cases, you could find a workaround if this need was the most important, though.

:)
paul

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
Paul

Did you mean

<input type="button"...

or is there something I've missed here? I didnt know there was a button control like this? Also i didnt knwo you could put HTML inside a button like that...Can you also do this by applying it with the value attribute? I'm going to have to have a play around with this now as i'm intrigued..%-)

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
You could also make it an Image Button and make an image with the text as desired.

Just an idea...

Hope everyone is having a great day!

Thanks - Jennifer
 
Jennifer - sure, that would work, just make it a transparent GIF, and who'd know the difference?
 
Thanks for the ideas.
I think the image button idea probably makes the most sense. I'm a newb to the web/html side of things so I'd rather keep the button as a server control.
 
Rob, I'm not sure what all is possible using this, as it was the result of some quick research and a little test I did where the code above did actually work.

I could not get the same thing to work with <asp:Button />, which sort of confused me, also.

I would have to agree w/ Jennifer, though. It seems to me a cleaner solution to just use an image button. That way, it is a full fledged server control w/ all the bells and whistles.

-p

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top