Reputation: 3905
In SQL server 2008 R2, I have a table with column containing nvarchar(max) data. When I print the value from this column for one record it displays like this.
Using VS2010, I have developed ASP.net web form with DetailsView, which shows above record as shown below. The line carriage and new line characters are lost while displaying on DetailsView !! Question is how can I view new lines?
Upvotes: 0
Views: 794
Reputation: 3905
Solved by using pre (preserve)
pre style="text-overflow: visible;white-space: pre-wrap
Upvotes: 1
Reputation:
You need to replace newline character \n
in the data field with HTML line break <br />
to display the text correctly on a web page.
You can replace the characters in the database query or stored procedure before returning the data to the presentation layer.
You can replace the characters while binding the data to the control in the presentation layer.
You might also want to use a fixed-width font if you want the data to align correctly.
Following link might help you with that.
How to do Replace("\n", "<br />") in detailsview BoundField data control
Upvotes: 1