Last post Sep 11, 2009 02:23 AM by decker dong - msft
Sep 07, 2009 02:21 PM|udayb99|LINK
Can anybody give me some tips on the easiest way to insert multiple lines in to database and retrieve the same multiple lines from database to gridview.The data displays on a single line. Is there any way to display multiple lines???
Sep 07, 2009 02:36 PM|ShailAtlas|LINK
If you insert multi line text from TextBox ( with TextMode="MultiLine"), it will insert "\r\n" for line breaks. That will be stored in DB also. Now if you want to display that in different lines in GridView, you need to replace those charecters "\r\n" with
That you can do in RowDataBound event of GridView or you can do in your SQL query also.
Sep 07, 2009 03:16 PM|basheerkal|LINK
Why you should save string in DB in multiple lines. If you store a very long string in Db, When you retrieve it, it will be displayed in mutilline if the width of the lable/multiline textbox is not sufficient to display the full string in a single line.
No special arrangements necessary ..
Sep 11, 2009 02:23 AM|decker dong - msft|LINK
Yes, indeed I think you can format your Text outputed by <p>...</p> (e.g: Suppose you want to add a new line at the end of each sentance with the mark ".", you can try like this):
1) First design your GridView like this:
2) Then write a protected function like this below in the cs file mapping to your aspx page in your project:
protected string FormationNow(object contents)
Notes: Words meeting with "</p>" these HTML singals will be reguared as HTML symbols until you use Html.Encoding() function.