DataGrid orientation?

Discussion in 'ASP .Net' started by =?Utf-8?B?U2VhbiBa?=, Apr 28, 2004.

  1. Hello is it possible to re-orient a DataGrid (i.e. make columns rows and vs)? That would be very helpful. Thank you.
     
    =?Utf-8?B?U2VhbiBa?=, Apr 28, 2004
    #1
    1. Advertising

  2. the easier way is to re-orient the dataset and bind it to the grid which
    gives the same effect.

    here's some code to flip 4 columns:

    //flip the columns with the rows
    double input = 0.0;
    for(int col = 0; col < ds.Tables[0].Columns.Count; col++)
    {
    DataRow myRow = dsTemp.Tables[0].NewRow();
    myRow[4]= 0.00;
    if(Double.TryParse(ds2.Tables[0].Rows[0][col].ToString(),
    System.Globalization.NumberStyles.Any,
    System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    myRow[4]= input.ToString();

    myRow[3]= 0.00;
    if(Double.TryParse(ds.Tables[0].Rows[0][col].ToString(),
    System.Globalization.NumberStyles.Any,
    System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    myRow[3]= input.ToString();

    if(Double.TryParse((Double.Parse(myRow[3].ToString()) -
    Double.Parse(myRow[4].ToString())).ToString(),
    System.Globalization.NumberStyles.Any,
    System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    myRow[2]= input.ToString();

    if(ds2.Tables[0].Rows[0][col].ToString().Trim() != String.Empty)
    myRow[1]= Math.Round(((Double.Parse(myRow[2].ToString()) /
    Double.Parse(ds2.Tables[0].Rows[0][col].ToString())) * 100),2);

    myRow[0]= ds.Tables[0].Columns[col].ColumnName;
    dsTemp.Tables[0].Rows.Add(myRow);
    }


    --
    Regards,
    Alvin Bruney
    [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
    Got tidbits? Get it here... http://tinyurl.com/27cok
    "Sean Z" <> wrote in message
    news:...
    > Hello is it possible to re-orient a DataGrid (i.e. make columns rows and
    > vs)? That would be very helpful. Thank you.
     
    Alvin Bruney [MVP], Apr 28, 2004
    #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. Ben

    Set doc orientation?

    Ben, Jan 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    394
  2. Joeyej
    Replies:
    0
    Views:
    8,089
    Joeyej
    Jun 4, 2004
  3. Yelena Kaplun
    Replies:
    1
    Views:
    5,205
    Yelena Kaplun
    Jan 19, 2005
  4. =?Utf-8?B?TWlrZSBNb29yZQ==?=

    Program IE Page Orientation

    =?Utf-8?B?TWlrZSBNb29yZQ==?=, Mar 7, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,511
    John Timney \(ASP.NET MVP\)
    Mar 7, 2005
  5. =?Utf-8?B?U0VHQUNP?=

    Change orientation datagrid

    =?Utf-8?B?U0VHQUNP?=, Feb 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,557
    Eliyahu Goldin
    Feb 28, 2006
Loading...

Share This Page