I've got a weird issue,
i've got a datarepeater that reads some user entries froma database, and then shows them in an <asp:label>
..
my 1st problem was that when the text is read all \n
s got dropped ..
so I use a <pre>
tag to solve the problem..
however... a new problem occurred..
now the text actually goes beyond the label's border..
<td width="630px" >
<pre>
<asp:Label ID="lblComments" runat="Server"
width="630px" Text='<%#DataBinder.Eval(Container.DataItem, "Comments") %>'
Style="font-size: larger">
</asp:Label>
</pre>
</td>
Yep, a pre will just output the text with little or no regard to the layout of the page.
You should be formatting the text from the database to convert \n's into <br/>
s.
You should be able to get away with something like:
<%# DataBinder.Eval(Container.DataItem, "Comments")
.ToString().Replace("\n", "<br />") %>
<pre> means preformatted so no additional line breaks are added to the text.
You'll have to shorten the line lengths in the preformatted text.
Use the css property "pre {white-space: normal;}
"
Does that work?
精彩评论