You are here:

Active Server Pages Programming (ASP)/How to show row value as Column heading in DataGrid

Advertisement


Question
problem:
i show data from sql data table into DataGrid.( i write sql query like "select * from table".)

assume that there is only one column in DataTable.
in that column there are 3 rows.

generally when we bind datagrid to such datasource what happens it displays that 3 rows  vertically.
here in my case i want to split that 3 rows into 3 columns. (i want to show that 3 rows horizontically)
e.g.
suppose that column has 3 rows comprises value

Pranav
Tushar
Appu

so now these 3 rows should be displayed in DataGrid as following:

Pranav     Tushar      Appu

however this is sample example. in real case number of rows are not fixed.

plz send me code.

I use asp.net 1.1
C#.net 1.1
MS Sql Server 2000
Windows 2000  

Answer
Hi

You can use ASP Datalist, which does   what you are looking for you can specify the repeat columns and repeat direction.

<ASP:DataList id="DataList1" RepeatColumns="2"
        RepeatDirection="Horizontal" runat="server">

Happy Programming!

-srini

Active Server Pages Programming (ASP)

All Answers


Answers by Expert:


Ask Experts

Volunteer


Srini Nagarajan

Expertise

I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience

Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.

©2012 About.com, a part of The New York Times Company. All rights reserved.