How to display the values in a Grid from an arraylist

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
Who is Participating?
Bob LearnedCommented:
Recreate the DataTable with the rows as columns.

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.