I want to format the content before showing it on a web page. I store '\ r \ n \' as enter into the database and try to replace it before showing the content on the web page. server side my code is:
lblComments.Text = Server.HtmlEncode(((DataRowView)e.Item.DataItem).Row["Comment"].ToString().Replace("\r\n", "<br>"));
I am using Server.HtmlEncode .
My output should be:
Comment Type: Public Comment: Commented on the Data by user A
But, it shows me everything on one line.
source share