Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Add newline to Gridview cell

Reply
Thread Tools

Add newline to Gridview cell

 
 
John Doe
Guest
Posts: n/a
 
      04-24-2007
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
 
 
 
 
John Timney \(MVP\)
Guest
Posts: n/a
 
      04-28-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add Row to datatable bound to gridview inside a gridview Elmo Watson ASP .Net 0 08-17-2006 02:26 PM
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
IDE in HTML mode: newline after closing tag? Add In? Timo ASP .Net 1 04-23-2004 11:53 AM
multilink cell phones multilinking shotgun 2 cell phones Calvin Cisco 1 11-07-2003 02:20 PM
Newline detected when add script in C# (ASP.NET) Ivan Demkovitch ASP .Net 2 11-05-2003 06:07 PM



Advertisments