Displaying line break in Datagrid

  • Thread starter Thread starter Niclas
  • Start date Start date
N

Niclas

Hi,

I have a multiline textbox used to submit values stored as VarChar in my SQL
database. I need to be able to retrieve this string and display it in a
datagrid column with the line breaks entered in the textbox maintained.

Is there a prefered solution available for this ?

Niclas
 
I would replace all occurences of vbCrLf i.e. character code 10 and 13
with the <BR/> tag. The datagrid outputs its contents as HTML and in
HTML whitespace characters such as vbCrLf are ignored. To specify line
breaks in HTML you have to specify the <BR/> tag in place of vbCrlf.

you can do this replacement at the point where you select your data
from the database in your select query. however, i prefer catching the
DataGrid's ItemDataBound event and fixing the data there - it might be
less efficient but its better in N-tier applications that I normally
write.

hope this helps bro
 
Back
Top