473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Formview Line Breaks

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
Aug 24 '06 #1
2 2466
Create a CSS style for your label. It should contain:

white-space: pre;

that'll do it!!

"MDB" wrote:
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">
<b><asp:Label ID="titleLabel" runat="server" Text='<%#
Bind("title") %>'></asp:Label></b>
</td>
</tr>
<tr>
<td align="left" style="background-color: #e0e0e0">
<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
Aug 24 '06 #2
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.
"David Jessee" <Da*********@discussions.microsoft.comwrote in message
news:B2**********************************@microsof t.com...
Create a CSS style for your label. It should contain:

white-space: pre;

that'll do it!!

"MDB" wrote:
>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">
<b><asp:Label ID="titleLabel" runat="server" Text='<%#
Bind("title") %>'></asp:Label></b>
</td>
</tr>
<tr>
<td align="left" style="background-color: #e0e0e0">
<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

Aug 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bill | last post by:
I am downloading data from a website that displays it in a table $fp = fopen("a website page", 'r'); The following accesses the stream one <td> element at a time $myData = fgets($fp); Then I...
6
by: Jonathan | last post by:
I want to save textarea contents to a mysql database with the paragraph breaks intact without having to type paragraph or break tags in HTML. How can I do that. So far, although it occurs naturally...
4
by: intl04 | last post by:
I have a memo field that is included in some Access reports I created. Is there some way for the memo field to display nicely formatted text, with line breaks between paragraphs? Or is it necessary...
2
by: Mike | last post by:
I need my textbox to work more smoothly with respect to line breaks. When I have data pulled from the database into a textbox there are hard line breaks at the end of each line (by definition how...
5
by: joelbyrd | last post by:
Didn't know exactly where to post this, but: How do I get line breaks in a textarea? I'm pulling text from a database, and this text definately has line breaks in it, because I replaced all the...
2
by: caspardh | last post by:
i was trying to code a morse code decipherer which workd fine except that the .txt file that i was converting had linebreaks built in, i cant get python to ignore the line breaks and i cant find any...
8
by: Harris Kosmidis | last post by:
It seems I cannot understand CSS, well. I have donw the following page: http://www.pennias.gr/home.php It's in greek but the context is of no importance. I used a big table to put in my page...
10
by: Itaichuk | last post by:
Hi I read in several CSS tutorials that block-level elements, such as <div& <pare rendered with an implicit line break before and after. I set to test this out using the following HTML: I...
1
by: =?ISO-8859-1?Q?thib=B4?= | last post by:
Hi, Taking a closer look to highlight_file() lastly, I found out that its line break policy was a bit.. strange. <?php # highlight_file() line breaks test $f = fopen('highlight_file_test',...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.