Friday, March 16, 2012

Newlines in Datagrid

I have a very simple Datagrid with one bound field. The field has
Environment.NewLines in it. When the datagrid is rendered, they don't
appear.

I have tried a few of different ways to get them to appear:

1.) Replace Environment.NewLine with <br> before saving to the
database.
2.) Replace Environment.NewLine with </br> before saving to the
database.

Neither of these work because ASP.NET just ends up printing out the
literal <br>, </br>.

Is there a way to replace the Environment.NewLines when the datagrid is
rendered? Alternatively, is there a specific value I should be saving
to get the Datagrid to properly render the <br>?Best solution for me is to create a template column
and then replace the ItemTemplate label with a multiline textbox..

We show addresses like that and it works.

HTH.

Gerhard

<chrismichaelgardner@.hotmail.com> wrote in message
news:1126037176.699190.204720@.z14g2000cwz.googlegr oups.com...
>I have a very simple Datagrid with one bound field. The field has
> Environment.NewLines in it. When the datagrid is rendered, they don't
> appear.
> I have tried a few of different ways to get them to appear:
> 1.) Replace Environment.NewLine with <br> before saving to the
> database.
> 2.) Replace Environment.NewLine with </br> before saving to the
> database.
> Neither of these work because ASP.NET just ends up printing out the
> literal <br>, </br>.
> Is there a way to replace the Environment.NewLines when the datagrid is
> rendered? Alternatively, is there a specific value I should be saving
> to get the Datagrid to properly render the <br>?

0 comments:

Post a Comment