Newlines in Datagrid

  • Thread starter chrismichaelgardner
  • 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>?
 
G

Gerhard Pretorius

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
 
Joined
May 4, 2009
Messages
1
Reaction score
0
New lines in datagrid

Change the datagrid column to a template column. Then <br> will work.

Happy Coding!
Reny
 

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

Forum statistics

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

Latest Threads

Top