Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Pivot a datagrid?

    I seem to remember seeing an article on how to reverse the data in a grid,
    so that each record creates a column rather than a row? Does anyone know
    how to do this? Thanks for your help.


    et Guest

  2. Similar Questions and Discussions

    1. Set pivot point of a brush
      Is there a way to set the brush's pivot point instead of it being automaticaly placed in the center of the shape ? So, if '1' is the shape and...
    2. Asp.net reports in the pivot table
      Hello, we r making a three tier application in which front end is Asp.net. In application we r supposed to show some reports. previously we were...
    3. Pivot Table View Problem
      I have the following problem: When a computer with W2000 was upgraded to WXP an Access XP form using Pivot Table View stopped working. Most of...
    4. Pivot Tables
      recently got a new computer with office xp, old computer had office xp, pivottables on old system worked great. on the new system I only get body...
    5. Monitor Pivot software for Mac OS 9.2
      Is there *any* software available to provide pivoting between portrait and landscape mode using Mac OS 9.2?? ViewSonic sold me a beautiful 21"...
  3. #2

    Default Re: Pivot a datagrid?

    Once rendering to cliend-side, a datagrid actually is html table. Hence if
    you just want to show data in a grid, you can manually create html table
    based on your data source, in a revering row/column arrangement.



    Or you can reverse row/column in data source. For example, the data source
    is a 8 columns and 5 rows datatable, you create a datatable with 5 columns
    then assign data from first datatable to second datatable. After binding
    datagrid's data source to the second datatable, it shows data in a reversing
    behavior.



    HTH





    "et" <eagletender2001@yahoo.com> wrote in message
    news:O6K4m%234uFHA.740@TK2MSFTNGP10.phx.gbl...
    >I seem to remember seeing an article on how to reverse the data in a grid,
    >so that each record creates a column rather than a row? Does anyone know
    >how to do this? Thanks for your help.
    >

    Elton Wang Guest

  4. #3

    Default Re: Pivot a datagrid?

    That's an idea, although not sure how to do the second one. You mean item
    by item I would have to place into the 2nd table? Could you give me some
    code or pseudo code examples?

    I also want pagination, hence the reason I am sticking to a grid. Thanks
    for you rhelp.


    "Elton Wang" <elton_wang@hotmail.com> wrote in message
    news:eo2c64FvFHA.3792@TK2MSFTNGP10.phx.gbl...
    > Once rendering to cliend-side, a datagrid actually is html table. Hence if
    > you just want to show data in a grid, you can manually create html table
    > based on your data source, in a revering row/column arrangement.
    >
    >
    >
    > Or you can reverse row/column in data source. For example, the data source
    > is a 8 columns and 5 rows datatable, you create a datatable with 5 columns
    > then assign data from first datatable to second datatable. After binding
    > datagrid's data source to the second datatable, it shows data in a
    > reversing behavior.
    >
    >
    >
    > HTH
    >
    >
    >
    >
    >
    > "et" <eagletender2001@yahoo.com> wrote in message
    > news:O6K4m%234uFHA.740@TK2MSFTNGP10.phx.gbl...
    >>I seem to remember seeing an article on how to reverse the data in a grid,
    >>so that each record creates a column rather than a row? Does anyone know
    >>how to do this? Thanks for your help.
    >>
    >
    >

    eagle Guest

  5. #4

    Default Re: Pivot a datagrid?

    Following is code snippet :

    DataTable secondTable = new DataTable();
    DataColumn col;
    for (int I = 0; I < datasource.Rows.Count; I++)
    {
    col = new DataColumn("Col" + I.ToString(),
    Type.GetType("System.String"));
    secondTable.Columns.Add(col);
    }

    DataRow newRow;
    for (int I = 0; I < datasource.Columns.Count; I++)
    {
    newRow = secondTable.NewRow();
    for (int J = 0; J< datasource.Rows.Count; J++)
    {
    newRow[J] = datasource.Rows[J][I].ToString();
    }
    secondTable.Rows.Add(newRow);
    }

    HTH

    "eagle" <eagletender2001@yahoo.com> wrote in message
    news:u8fd5asvFHA.2808@TK2MSFTNGP10.phx.gbl...
    > That's an idea, although not sure how to do the second one. You mean item
    > by item I would have to place into the 2nd table? Could you give me some
    > code or pseudo code examples?
    >
    > I also want pagination, hence the reason I am sticking to a grid. Thanks
    > for you rhelp.
    >
    >
    > "Elton Wang" <elton_wang@hotmail.com> wrote in message
    > news:eo2c64FvFHA.3792@TK2MSFTNGP10.phx.gbl...
    > > Once rendering to cliend-side, a datagrid actually is html table. Hence
    if
    > > you just want to show data in a grid, you can manually create html table
    > > based on your data source, in a revering row/column arrangement.
    > >
    > >
    > >
    > > Or you can reverse row/column in data source. For example, the data
    source
    > > is a 8 columns and 5 rows datatable, you create a datatable with 5
    columns
    > > then assign data from first datatable to second datatable. After binding
    > > datagrid's data source to the second datatable, it shows data in a
    > > reversing behavior.
    > >
    > >
    > >
    > > HTH
    > >
    > >
    > >
    > >
    > >
    > > "et" <eagletender2001@yahoo.com> wrote in message
    > > news:O6K4m%234uFHA.740@TK2MSFTNGP10.phx.gbl...
    > >>I seem to remember seeing an article on how to reverse the data in a
    grid,
    > >>so that each record creates a column rather than a row? Does anyone
    know
    > >>how to do this? Thanks for your help.
    > >>
    > >
    > >
    >
    >

    Elton Wang Guest

  6. #5

    Default Re: Pivot a datagrid?

    that works! thanks so much for your help.

    "Elton Wang" <elton_wang@hotmail.com> wrote in message
    news:%23HYz7ntvFHA.2504@tk2msftngp13.phx.gbl...
    > Following is code snippet :
    >
    > DataTable secondTable = new DataTable();
    > DataColumn col;
    > for (int I = 0; I < datasource.Rows.Count; I++)
    > {
    > col = new DataColumn("Col" + I.ToString(),
    > Type.GetType("System.String"));
    > secondTable.Columns.Add(col);
    > }
    >
    > DataRow newRow;
    > for (int I = 0; I < datasource.Columns.Count; I++)
    > {
    > newRow = secondTable.NewRow();
    > for (int J = 0; J< datasource.Rows.Count; J++)
    > {
    > newRow[J] = datasource.Rows[J][I].ToString();
    > }
    > secondTable.Rows.Add(newRow);
    > }
    >
    > HTH
    >
    > "eagle" <eagletender2001@yahoo.com> wrote in message
    > news:u8fd5asvFHA.2808@TK2MSFTNGP10.phx.gbl...
    >> That's an idea, although not sure how to do the second one. You mean
    >> item
    >> by item I would have to place into the 2nd table? Could you give me some
    >> code or pseudo code examples?
    >>
    >> I also want pagination, hence the reason I am sticking to a grid. Thanks
    >> for you rhelp.
    >>
    >>
    >> "Elton Wang" <elton_wang@hotmail.com> wrote in message
    >> news:eo2c64FvFHA.3792@TK2MSFTNGP10.phx.gbl...
    >> > Once rendering to cliend-side, a datagrid actually is html table. Hence
    > if
    >> > you just want to show data in a grid, you can manually create html
    >> > table
    >> > based on your data source, in a revering row/column arrangement.
    >> >
    >> >
    >> >
    >> > Or you can reverse row/column in data source. For example, the data
    > source
    >> > is a 8 columns and 5 rows datatable, you create a datatable with 5
    > columns
    >> > then assign data from first datatable to second datatable. After
    >> > binding
    >> > datagrid's data source to the second datatable, it shows data in a
    >> > reversing behavior.
    >> >
    >> >
    >> >
    >> > HTH
    >> >
    >> >
    >> >
    >> >
    >> >
    >> > "et" <eagletender2001@yahoo.com> wrote in message
    >> > news:O6K4m%234uFHA.740@TK2MSFTNGP10.phx.gbl...
    >> >>I seem to remember seeing an article on how to reverse the data in a
    > grid,
    >> >>so that each record creates a column rather than a row? Does anyone
    > know
    >> >>how to do this? Thanks for your help.
    >> >>
    >> >
    >> >
    >>
    >>
    >
    >

    et Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139