How to display the values in a Grid from an arraylist

Posted on 2006-03-27
Last Modified: 2010-04-16
Hi, I'm having an arraylist and in the arraylist I have values for 24 hours in a day. For each Unit(which is a primary field) I have multiple column values for each hour. When I fill the datable and to dataset
and bind the dataset I get displayed vertically instead of horizontally how to flip the values and display it.

Here is how it looks like:

Hour Ending1
       Unit1,colum1,column2 values
Hour Ending 2
      Unit1,column1,column2 values
...SO on
Hour Ending 24
     Unit1,column1,column2 values.

Here is how I want:

Hour Ending1                                Hour Ending2    
Unit1,column1,column2 values        Unit1,column1,column2 values and
So on.. Hour Ending24.

comments:I'm currently doing this from the array list:

 ArrayList umarray = m_clsum.Build1(um); //<--I get arraylist from class.

                //System.Data.DataSet ds = new System.Data.DataSet("umarray");
                             DataSet ds = new DataSet();
                Type myType = umarray[0].GetType();
                System.Reflection.PropertyInfo[] api = myType.GetProperties();

                foreach (System.Reflection.PropertyInfo pi in api)
                System.Data.DataRow dr = null;
                foreach (object obj in umarray)
                    dr = dt.NewRow();
                    foreach (System.Data.DataColumn myColumn in dt.Columns)
                       dr[myColumn.Caption] = myType.GetProperty(myColumn.Caption).GetValue(obj, null);
                int i;
                int hour = DateTime.Now.Hour;
                for (i = 0; i <= (ds.Tables[0].Columns.Count - 1); i = i + 1)
                    ds.Tables[0].Columns[i].ColumnName = ds.Tables[0].Columns[i].ColumnName + hour;
                string colname;
                colname = ds.Tables[0].Columns[15].ColumnName;


Thanks VM
Question by:vmandem
    1 Comment
    LVL 96

    Accepted Solution

    Recreate the DataTable with the rows as columns.


    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now