Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataGrid orientation?

Reply
Thread Tools

DataGrid orientation?

 
 
=?Utf-8?B?U2VhbiBa?=
Guest
Posts: n/a
 
      04-28-2004
Hello is it possible to re-orient a DataGrid (i.e. make columns rows and vs)? That would be very helpful. Thank you.
 
Reply With Quote
 
 
 
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      04-28-2004
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.InvariantInf o, 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.InvariantInf o, 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.InvariantInf o, 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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello is it possible to re-orient a DataGrid (i.e. make columns rows and
> vs)? That would be very helpful. Thank you.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Datagrid: how cut short display of a long description in a datagrid column Brian K. Williams ASP .Net 0 03-02-2004 08:35 PM
RE: Datagrid: how cut short display of a long description in a datagrid column =?Utf-8?B?U3VyZXNo?= ASP .Net 0 03-02-2004 08:31 PM
datagrid in datagrid BK Kim ASP .Net 1 03-02-2004 06:34 AM
Call Datagrid Command column outside datagrid Dave ASP .Net 0 11-20-2003 11:11 AM
To all Gurus: How can I edit/update a DataGrid in a DataGrid (nested DataGrid)? Possible? Andreas Klemt ASP .Net Datagrid Control 0 10-08-2003 01:19 AM



Advertisments