HighTechTalks DotNet Forums  

Add newline to Gridview cell

ASP.net Data Grid Control microsoft.public.dotnet.framework.aspnet.datagridcontrol


Discuss Add newline to Gridview cell in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
John Doe
 
Posts: n/a

Default Add newline to Gridview cell - 04-24-2007 , 06:02 PM






I'm binding a Gridview to a DataTable. I want to display the Gridview cells
with multiline values. In populating the data for the DataTable, I use
Environment.Newline but the data doesn't display in Gridview as multiline:

newRow[myDataColumn.Ordinal] = diff.ToString("N")+ Environment.Newline +
pct.ToString("P");




Reply With Quote
  #2  
Old   
John Timney \(MVP\)
 
Posts: n/a

Default Re: Add newline to Gridview cell - 04-28-2007 , 05:47 PM






Look at your source code output and I would hazard a guess that your newline
isn't being rendered as <br>, which in html would create a newline. If I
recall correctly, you can only do this using templatefields, so have a read
of a few tutorials like this one to start:

http://aspnet101.com/aspnet101/tutorials.aspx?id=58

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog


"John Doe" <jdoe (AT) msn (DOT) com> wrote

Quote:
I'm binding a Gridview to a DataTable. I want to display the Gridview
cells with multiline values. In populating the data for the DataTable, I
use Environment.Newline but the data doesn't display in Gridview as
multiline:

newRow[myDataColumn.Ordinal] = diff.ToString("N")+ Environment.Newline +
pct.ToString("P");






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.