473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DataGrid orientation?

Hello is it possible to re-orient a DataGrid (i.e. make columns rows and vs)? That would be very helpful. Thank you.
Nov 18 '05 #1
1 1688
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" <an*******@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com...
Hello is it possible to re-orient a DataGrid (i.e. make columns rows and
vs)? That would be very helpful. Thank you.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bruce Adams | last post by:
I am using VB6 SP6. I have an application that prints charts. Specifically, it prints line charts of plant process information nightly. The code is a mix of API calls and Printer methods. I am...
1
by: Az Tech | last post by:
Hi people, (Sorry for the somewhat long post). I request some of the people on this group who have good experience using object-orientation in the field, to please give some good ideas for...
4
by: tvmaly | last post by:
Does anyone know if it is possible to determine if an image is horizontal/vertical and color or black & white using the python image library? I have been searching this news group and the...
11
by: Vishal Naidu | last post by:
i m a college student in my second year..... my queston is.. is it really possible to write object oriented code in C ? and if yes how do we achieve abstration, polymorhism , hierarchy etc. in C
0
by: Glenn Engelbart | last post by:
I am trying to find out a way to get more code re-use & object orientation in the UI portion of my apps. (There already is plenty of both in the DataAccess & Business Logic portion of my apps. ...
1
by: Andrew | last post by:
I'm adding this as it to me a while to figure out all the pieces to be able to do this without using Microsoft.Office.Interop which caused me problems on the web-server. Streaming is the easy...
5
by: Zadkin | last post by:
Does anyone know, if it's possible to set the orientation of the tabpagebuttons to horizontal instead of vertical when the alignment property of my tabcontrol is set to left or right? Thanks in...
1
by: SEGACO | last post by:
I need to create a report in a datagrid that displays some data in vertical orientation, for example STATE CITY Florida Miami Florida Miami Florida Miami that only Florida...
4
by: dinoo | last post by:
I would appreciate if some one could help me out with this problem. I am trying to export the datagrid to an excel file in ASP.NET. The functionality works fine. But I would like to setup the...
2
daniel aristidou
by: daniel aristidou | last post by:
Hi i wrote code to print records off a datagrid.the code works on all but one of my data grids. The problem is that loop continues without stopping, Causing the program to crash. The only diff...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.