columns with data in a gridview

Discussion in 'ASP .Net' started by Carlos, Feb 26, 2009.

  1. Carlos

    Carlos Guest

    Hi all,

    I'd like to have a gridview that contains as columns the year values
    that are contained in a table. That is, in the gridview, the rows should
    be labeled instead of the columns.(which contain the values for the years).

    for instance:

    2000 2001 2002

    abc 2 3 1

    ced 56 49 51

    zxc 19 21 20

    What would be the best way to do that?

    Thanks,

    Carlos.
    Carlos, Feb 26, 2009
    #1
    1. Advertising

  2. You can load data to a datatable, create another one with swapped
    rows/columns and then databind it to the grid. Here is an example:

    http://www.codeproject.com/KB/datab...spx?df=100&forumid=23370&exp=0&select=1539372


    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin


    "Carlos" <> wrote in message
    news:...
    > Hi all,
    >
    > I'd like to have a gridview that contains as columns the year values
    > that are contained in a table. That is, in the gridview, the rows should
    > be labeled instead of the columns.(which contain the values for the
    > years).
    >
    > for instance:
    >
    > 2000 2001 2002
    >
    > abc 2 3 1
    >
    > ced 56 49 51
    >
    > zxc 19 21 20
    >
    > What would be the best way to do that?
    >
    > Thanks,
    >
    > Carlos.
    >
    Eliyahu Goldin, Feb 28, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jacksm
    Replies:
    2
    Views:
    828
    Paul Chalekian
    Nov 21, 2006
  2. =?Utf-8?B?dmFuZGls?=
    Replies:
    2
    Views:
    1,168
    Eliyahu Goldin
    Jan 25, 2007
  3. Robson Siqueira
    Replies:
    1
    Views:
    1,392
    bruce barker
    May 1, 2007
  4. John
    Replies:
    0
    Views:
    431
  5. Vinki

    template columns and bound columns in gridview

    Vinki, Apr 25, 2007, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    833
    Vinki
    Apr 25, 2007
Loading...

Share This Page