We help IT Professionals succeed at work.

Using wrap for ASP.net Label control?

Ramana99 asked
Medium Priority
Last Modified: 2008-01-09
I am working on an ASP web application and have one ascx page where I display data(which actually reads from database) in an asp.net label control which actually resides in a html table in a row which is shown in code as below:
<TABLE id="Table8" cellSpacing="0" cellPadding="0" width="670" border="0">
<TR class="PRegularText" vAlign="top">
<TD class="PRegularText" style="WIDTH: 19px" height="23">&nbsp;</TD>
<TD class="PRegularText" height="23"><asp:label id="lblSourceofRevenue" runat="server" CssClass="PRegularText"></asp:label></TD>

Now I am getting an issue that there is large text for that label the entire page display is going too far to the right making the page disaligned and errors while printing.I do want the text in that label to be wrap to next line.
If you can open the URL http://www.ecb.ohio.gov/Public/ShowAgenda.aspx and click on AGR230 REquest you will se compared to other requests.
The strange thing is when displaying a question which is the normal text its automatically wrapped which is below:
<TR class="PRegularText" vAlign="top">
<TD class="PRegularText" style="WIDTH: 19px">2.</TD>
<TD class="PRegularText">If applicable, explain why creating and/or increasing a
new fund and/or line item is more appropriate than depositing the revenue into
an existing fund and increasing the appropriation authority of an existing line

Please help me with this so that my page is properly aligned with a fixed width and data in the label controls not crossing the margins? I used wrap="true" and set width="100" and other smallest possible length both in label control and also in TD and TR but of no use?
Watch Question

try STYLE="word-wrap:break-word;"
cls u post the style for PRegularText

also the td in which u have the label .. the width is not specified .. unless its specified in the "style"

<TD class="PRegularText" width="200" height="23"><asp:label id="lblSourceofRevenue" runat="server" style="width:100%" CssClass="PRegularText"></asp:label></TD>

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.