Thursday, April 03, 2008

Display Multiline Text from the Database on ASP.NET webpage

In order to display multiline text from the database, I used the following code. I used textbox and removed its borders (set BorderStyle= None and BorderWidth= 0px) and scrollbar (To hide scrollbar, added style="overflow:hidden in ASP textbox tag).

string newsBody = GetText(); // From the database

NDNewsBody_TextBox.Rows = newsBody.Length;

NDNewsBody_TextBox.Text = newsBody;