Solved

word wrap in label

Posted on 2006-11-01
7
1,067 Views
Last Modified: 2008-03-04
I've got a multi line text box on one page.
when a user clicks a button on that page, it opens up another window and uses a session
to transfer the data from that textbox to a label on the new page.
is there a way to make the text fit into the size of the label.
it's just making it one long line and i need it to wrap at the end of the label.
thanks.

0
Comment
Question by:mwmiller78
  • 4
  • 3
7 Comments
 
LVL 11

Expert Comment

by:ethoths
ID: 17851799
Use a div (asp:panel) rather than a label and set the css overflow properties accordingly.

0
 

Author Comment

by:mwmiller78
ID: 17851947
what do i set overflow to? auto?
0
 
LVL 11

Expert Comment

by:ethoths
ID: 17853231
It depends on what behavoiur you want. Auto is a good choice but dont forget you also have the text-overflow attribute whick you can set to elipses... That is cool because you can then use other effects to show the whole of the text when you mouseover or click for example.
 
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 11

Expert Comment

by:ethoths
ID: 17853426
PS            

Here some mark up to get you started...

<div onmouseover="document.getElementById('tooltip1').style.visibility='visible';"onmouseout="document.getElementById('tooltip1').style.visibility='hidden';" style="height:20;width:100;background-color:red;overflow:hidden;text-overflow:ellipsis" nowrap >This is a long piece of test that just goes on and on.</div>
<div style="width:144;background-color:yellow;visibility:hidden" id="tooltip1">This is a long piece of test that just goes on and on.</div>
0
 

Author Comment

by:mwmiller78
ID: 17893415
ok i've got it pretty much working now. there's only one other thing. if i enter in a bunch of characters without a break in them
(i.e. wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww)
it just has one line and cuts off wherever the label ends. is there any way to force it to wrap within the label using the method above?
0
 
LVL 11

Accepted Solution

by:
ethoths earned 500 total points
ID: 17896421
You'll need to write some code for that one. Either server side or js can do it. Why would you ever have such a thing anyway.

IE has an elipses style. It truncates the string and appends ... to it so that it fits in the conmtainer - but that's not what you want.
0
 

Author Comment

by:mwmiller78
ID: 17898055
no i do want it to fit the container. i'm saying that a continuous string is not fitting the container. it's staying on one line and it just cuts off at the end of the width of the label. it's not really a huge deal since i doubt there will ever be a situation where a user would enter a word longer than the width of the label, it's just something i noticed and figured it could possibly become problematic somewhere down the road.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question