Where you can find it? I don't understand. I thought you wanted to alter the ShowAd.aspx page so that any line breaks that exist in the description field in the database are rendered as such on the web page. If I understand correctly, then you need to replace
<%# Eval("Description") %> on ShowAd.aspx with the code I posted earlier.
If you are using VB.NET, change it to <%# Eval("Description").ToString().Replace(vbcrlf, "<br />"). That was the C# version I posted earlier.
By the way, it was far from trivial for me before I found out how to do it. And if the above works for you, it will be trivial for you from now on.[:D]
None
0 Points
30 Posts
Formatting description field
Apr 06, 2007 11:43 AM|didi8181|LINK
Hi,
Would you please advice me on what should be change in the order to have new lines/paragraphs in the description field of classifieds?
The classifieds template is just one paragraph in bold.
Thank you.
Regards,
Den
All-Star
184748 Points
26712 Posts
Moderator
MVP
Re: Formatting description field
Apr 06, 2007 12:27 PM|Mikesdotnetting|LINK
You need to replace new lines with their html equivalent - "<br />"
<%# Eval("Description").ToString().Replace("\r","<br />") %>
ASP.NET Tutorials | Learn Entity Framework Core| Learn Razor Pages
None
0 Points
30 Posts
Re: Formatting description field
Apr 06, 2007 12:45 PM|didi8181|LINK
Thank you for the reply.
Would you please tell me where i can find this line of code?
Thank you.
Regrads.
Den
All-Star
184748 Points
26712 Posts
Moderator
MVP
Re: Formatting description field
Apr 06, 2007 01:09 PM|Mikesdotnetting|LINK
ASP.NET Tutorials | Learn Entity Framework Core| Learn Razor Pages
None
0 Points
30 Posts
Re: Formatting description field
Apr 06, 2007 01:36 PM|didi8181|LINK
Hi,
Thank you – well, I have changed it at showad.aspx, but it doesn’t show it correctly.
If I lets say add new ad with:
Line1
Line2
Line3
Than in showed.aspx is like Line1 Line2 Line3…
Maybe I should change something at Postad.aspx or somewhere else? Sorry – this is for you probably trivial, but I cannot figure out…
Thank you for help.
Regards
Den
All-Star
184748 Points
26712 Posts
Moderator
MVP
Re: Formatting description field
Apr 06, 2007 02:02 PM|Mikesdotnetting|LINK
If you are using VB.NET, change it to <%# Eval("Description").ToString().Replace(vbcrlf, "<br />"). That was the C# version I posted earlier.
By the way, it was far from trivial for me before I found out how to do it. And if the above works for you, it will be trivial for you from now on.[:D]
ASP.NET Tutorials | Learn Entity Framework Core| Learn Razor Pages