Monday, March 26, 2012

Populate asp:label with text from db and retain formatting?

set the text box Text Mode property to MultiLine.

Av.

"Tony" <anonymous@dotnet.itags.org.discussions.microsoft.com> wrote in message
news:7B9C3796-02D8-4180-AD93-8572746CD951@dotnet.itags.org.microsoft.com...
> Hello,
> Im can't seem to figure this out OR find any documentation on if it's
> possible; I need to populate the value of an asp:label with text retrieved
> from the database. However when the text is populated I need to retain
> carriage returns and indents that the text contains. That way if I want to
> see this:
> Some text with a manual
> carriage return.
> 1. this is one.
> 2. this is two.
> It doesn't look like this:
> Some text with a manual carriage return. 1. this is one. 2. this is two.
> I've tried enclosing the text in <pre></pre> tags before the text is
> assigned to the label and it works fine except for 2 things. The text is
> rendered in a non-styled font and in the instance that the user entered
> really long text and didn't manullay hit a carriage return- which causes
> the text continue to the right instead of automatically wrapping even
> though I define a width on my label, the cell the label is within, etc..
> Does anyone know how to get this to work? I must have looked around on the
> net for hours!TextMode is not a property for a label but a textbox. I have tried using a textbox control with this property set to multiline previously however without specifically setting the height of the textbox I end up with vertical scrollbars- which I cannot have because this is for a printable report.

0 comments:

Post a Comment