Click here to Skip to main content
15,936,903 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I have small code in gridview, data retriving from database.

Now db records are,

EmpId EmpName EmpAddress
------------------------
1. Raju Ban
2. Ravi Hyd
3. Ram Ban
4. Radha Hyd
5. Rajesh Mum


Now i want to display records as,

Raju Ravi Ram
Ban Hyd Ban


Radha Rajesh
Hyd Mum


please can any one help me. I am using bellow code. Thanks in advance.

<asp:TemplateField ItemStyle-VerticalAlign="Top" >

<asp:Label ID="Label1" runat="server" Text='<%# Eval("EmpName")+""+Eval("EmpAddress") %>'>
Posted

1 solution

Hi,

Which database are you using ? Why dont you use pivot on the table and get the desired data from database itself by writing a stored proc or something. It will cater your needs and will be simpler.

Try these links :
http://blog.sqlauthority.com/2008/06/07/sql-server-pivot-and-unpivot-table-examples/[^]

http://technet.microsoft.com/en-in/library/ms177410%28v=sql.105%29.aspx[^]

Hope this helps. :)

Regards,
Praneet
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900