Active Server Pages Programming (ASP)/How to show row value as Column heading in DataGrid
Expert: Srini Nagarajan - 2/25/2005
Questionproblem:
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
AnswerHi
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