Formatting text in datagrid.
-
Hello, I want to display a large amount of data in my datagrid column, but the problem is when i fetch data, it just appends all lines and fetches as a single paragraph, but i want to preserve the paragraph, spaces or blank lines and fetch exactly the way i have typed in my textbox. Any idea?
-
Hello, I want to display a large amount of data in my datagrid column, but the problem is when i fetch data, it just appends all lines and fetches as a single paragraph, but i want to preserve the paragraph, spaces or blank lines and fetch exactly the way i have typed in my textbox. Any idea?
The reason it does this is that the datagrid renders as an HTML table, and tables do not see whitespace as textboxes, or textareas do, in that they merge whitespace and do not understand line breaks. One way to overcome this is to replace all spaces with and all line breaks with
or. hope this helps, sivilian
-
Hello, I want to display a large amount of data in my datagrid column, but the problem is when i fetch data, it just appends all lines and fetches as a single paragraph, but i want to preserve the paragraph, spaces or blank lines and fetch exactly the way i have typed in my textbox. Any idea?
Create a Template and when you get the string sYourString.Replace("\r", "
); Is that what you were asking? Al -
Create a Template and when you get the string sYourString.Replace("\r", "
); Is that what you were asking? AlDataGrids to my understanding do not recognize whitepage so yeah do like he is saying. what i do is this. i have a templated column and its id is TextBox1. Also in the html part where you see the template put in TextMode=MultiLine; that way you can have a scroll and type in whatever you want. It doesn't understand the whitespace and breaks so to make it understand it do like Albert Mentioned. TextBox tb1 = ((TextBox)e.Item.FindControl("TextBox1")); tb1.Text= tb1.Text.Replace("\n","
"); what this will do is take the current text of your textbox and where it fines new lines you want to add a
so it does a break. I hope this helps. Win32newb "Programming is like sex, make one mistake and you have to support it for a long time"