line break in a datagrid

line break in a datagrid

Post by hanne » Mon, 14 Mar 2005 18:59:01


hello to all,

how to get an line break from a database to the datagrid?

thanks,
hannes
 
 
 

line break in a datagrid

Post by Riki » Mon, 14 Mar 2005 22:48:58


You didn't say in which language. I'm using VB.NET here.

Turn AutoGenerateColumns off. Add BoundColumns instead.
For the column that has line breaks, convert the BoundColumn
to a TemplateColumn.
In the TemplateColumn replace
<%# DataBinder.Eval(Container.DataItem,"myField") %>
with
<%#
DataBinder.Eval(Container.DataItem,"myField").ToString().Replace("vbCRLF","<br>")
%>

--

Riki