Solved

word wrap in label

Posted on 2006-11-01
7
1,069 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:Mike Miller
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Mike Miller
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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:Mike Miller
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:Mike Miller
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 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