Grid View
-
I have a gridview on a webform. The table with the data I want it to display has a column with contents like: "Item1 Item2 Item3". What I want to do is make each one of these items appear on a new line in the cell that they are in. How would I do this? I tried using "\r\n" and "< br >" between the items, but no luck :( eg.
Some Column
| Item1 |
| Item2 |
| Item3 |
| ... |
|___________________|___________
| |
| |
| |
| |If this will be too much trouble does anyone know a similar control that I can get the same effect with? Thanks for any help ;)
-
I have a gridview on a webform. The table with the data I want it to display has a column with contents like: "Item1 Item2 Item3". What I want to do is make each one of these items appear on a new line in the cell that they are in. How would I do this? I tried using "\r\n" and "< br >" between the items, but no luck :( eg.
Some Column
| Item1 |
| Item2 |
| Item3 |
| ... |
|___________________|___________
| |
| |
| |
| |If this will be too much trouble does anyone know a similar control that I can get the same effect with? Thanks for any help ;)
Sean89 wrote:
The table with the data I want it to display has a column with contents like: "Item1 Item2 Item3".
So assuming you probably know how to slit the items.
Sean89 wrote:
How would I do this? I tried using "\r\n" and "< br >" between the items,
You can use the TemplateField here. Before you send the output to the page in this TemplateField, you can process data a bit by splitting the items and seperate by the
<br/>
, then output to the page. Can I see your sample code to know why it does not work with you? -
Sean89 wrote:
The table with the data I want it to display has a column with contents like: "Item1 Item2 Item3".
So assuming you probably know how to slit the items.
Sean89 wrote:
How would I do this? I tried using "\r\n" and "< br >" between the items,
You can use the TemplateField here. Before you send the output to the page in this TemplateField, you can process data a bit by splitting the items and seperate by the
<br/>
, then output to the page. Can I see your sample code to know why it does not work with you?Basically I have two related tables in a database. I put both of them into a dataset and construct one table based in there relation, and bind it to the control. However, I wasnt using the template field. How do I use it once I have added one to the grid? Thanks for the reply
-
Basically I have two related tables in a database. I put both of them into a dataset and construct one table based in there relation, and bind it to the control. However, I wasnt using the template field. How do I use it once I have added one to the grid? Thanks for the reply
-
Looks like you might want to build the Master/Details data with the GridView control. You can see a series of the GridView examples from here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/GridViewEx.asp[^]