Displaying line break in Datagrid

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
 
Joined
Feb 4, 2010
Messages
28
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top