When using Template Fields in controls like the DetailsView, or the Gridview, for the ItemTemplateField, if the Line Breaks you entered into the database are not showing, it’s a fairly simple fix.
For instance, if you’re using a label for the ItemTemplateField, and the text is designated as:
Text='<%# eval("Description") %>'
Just change it to the following:
Text='<%# eval("Description").ToString().Replace(vbcrlf, "<br />" %>'
If vbcrlf doesn’t work for you or you’re using C#, replace it with
‘Environment.NewLine’.
All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF
Leave a reply
You must be logged in to post a comment.