Newlines in Datagrid

  • Thread starter Thread starter chrismichaelgardner
  • Start date Start date
C

chrismichaelgardner

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
 

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

Back
Top