DataSet transpose in ASP.NET

In my ASP.NET code (C# Visual Studio 2008) I am have obtained this dataset by querying the Oracle database table:

The dataset looks like this:
However the number of columns (here it is 4) is not constant in the obtained dataset.
f1             f2                            f3                    f4
--------------------------------------------------------
AAA              Lead_of_AAA      10/2/2011      4
AAA              Lead_of_AAA      10/9/2011      5
AAA              Lead_of_AAA      10/16/2011      8
BBB      Lead_of_BBB      10/2/2011      7
BBB      Lead_of_BBB      10/9/2011      0
BBB      Lead_of_BBB      10/16/2011      5
CCC      Lead_of_CCC      10/2/2011      3
CCC      Lead_of_CCC      10/9/2011      1
CCC      Lead_of_CCC      10/16/2011      8

How could I transpose this data set to obtain a dataset like:

f1       f2                        10/2/2011    10/9/2011  10/16/2011
--------------------------------------------------------------------------
AAA   Lead_of_AAA    4                     5                8
BBB   Lead_of_BBB  7                      0               5
CC    Lead_of_CCC  3                      1               8

Here I could assume f3 contents are string variable (not dates).
I am trying to do exactly opposite (converse) of what was done in http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_27279048.html .
toookiAsked:
Who is Participating?
 
AnuTijiCommented:
hi

Please refer the link below.
http://www.codeproject.com/KB/database/TransposeTable.aspx
In this the function 'GenerateTransposedTable' transpose a datatable and returns the result as datatable
0
 
toookiAuthor Commented:
Thank you.
The link in
http://aspdotnetmatters.blogspot.com/2010/10/transpose-data-table-in-net.html
worked for me.
I could create a DataTable with required columns in the gridview.
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.