Formview Line Breaks

M

MDB

Hello All, I have a label in a form view that I need to have display the
line breaks. Is there an easy way to do this? For some reason, I havn't
been able to find a straigh answer on this.

Here is what I have:

<asp:FormView ID="FormView1" runat="server" DataKeyNames="ID"
DataSourceID="SqlDataSource2" Width="565px">
<itemtemplate>
<table width="565" style="table-layout: fixed;word-break:break-all" >
<tr>
<td style="color: white; background-color: #d40000; text-align:
center">
&nbsp;<b><asp:Label ID="titleLabel" runat="server" Text='<%#
Bind("title") %>'></asp:Label></b>
</td>
</tr>
<tr>
<td align="left" style="background-color: #e0e0e0">
&nbsp;<asp:Label ID="blogentryLabel" runat="server"
Text='<%# Server.HtmlEncode(Eval("blogentry").ToString())
%>'></asp:Label></td>
</tr>

</table>
</itemtemplate>
</asp:FormView>


It displays the text like this (one continuous line):


as fsdajfkl jdjsdkfa jdsklfj;a fjf asdkf;lj kl;fajdf; dkjf daf;lsaf
fsakffas' fafds;f kdjf fafds;f kdjf ds;f kdjf fafds;f kdjf sajhf dsafkaj
fdfkashf oidsahfda fhadsifjep89fa jfsafdajf 9o8afsafkasca ewauifa oiduaf
aifuosad oiaufp ndsaopi ufwaoiauf snkzpoweqiurf ajsdopfueqw

If I view this source it is displayed correctly with the line breaks:

sjadfjl akjf

aksj fsakf

asd hfsadf asdf lkwajf oaiu asjkldsj oiqua

I am sorry for asking a question that appears to have been asked multiple
time however, I still can not seem to get it figured out.

Thanks In Advance
 
G

Guest

Create a CSS style for your label. It should contain:

white-space: pre;

that'll do it!!
 
M

MDB

That worked great, now I have a new question, how do I get to to word wrap?
I ahve the width set to 565 but the lines never break.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top