473,321 Members | 1,748 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,321 software developers and data experts.

Flipped Gridview Control

In a traditional gridview control the items inserted(bind) into the
control are rows and the data is in columns. I have a customer who
wants the data fields as rows and the columns as the items being
inserted(bind). I have never seen a gridview control displayed in
this fashion but would like to use a control to accomplish this, so I
am wondering if this is possible or if someone has an idea on how to
accomplish this. Thanks.

normal gridview can I??
1 2 3

1 data data data
data data data

2 data data data
data data data

3 data data data
data data data

Feb 13 '07 #1
1 7834
"spitapps" wrote:
In a traditional gridview control the items inserted(bind) into the
control are rows and the data is in columns. I have a customer who
wants the data fields as rows and the columns as the items being
inserted(bind). I have never seen a gridview control displayed in
this fashion but would like to use a control to accomplish this, so I
am wondering if this is possible or if someone has an idea on how to
accomplish this. Thanks.
<snip>

spitapps,

What you are asking for is often called a pivot, cross-tab, or rotated data.
Unfortunately, the GridView control does not directly support a cross-tab
mode. You'll have to either pivot your data inside your stored procedure or
select back the data into a DataTable and then pivot the DataTable.

I personally think rotating your DataTable is easiest, but that is a matter
of preference. If you rotate a DataTable then the pivot logic is simpler
(don't have to deal with dynamic sql) but have to manually bind the GridView
to your rotated DataSet. If you use sql 2005's pivot or dynamic sql, the
pivot logic is a bit more complex but you can bind the GridView using a
SqlDataSource.

There are a lot of links for this type of operation on Google. Here are a
few that you might find helpful.

Pivoting a DataTable/DataSet:
http://aspalliance.com/538

SQL 2005 pivot syntax:
http://www.programmersheaven.com/2/S...ol-lesson-4-p2

Using dynamic sql to pivot data (in case you are running on a database that
does not support a pivot syntax or if the pivot syntax is not adequate):
http://www.sqlteam.com/item.asp?ItemID=2955

Hope this helps,
Jason Vermillion

Feb 13 '07 #2

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

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
3
by: | last post by:
Hello, I have created an ASP.NET 2.0 application that utilized a Gridview Control to display and update/delete data. The problem I am having is that the gridview control is displaying the data...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
4
by: Jim Katz | last post by:
I have an application that updates a strongly typed data set at run time. I'd like to dynamically create a table that connects to a run time data table. For displaying the data, this works well. ...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
1
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes...
5
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the...
1
by: spitapps | last post by:
In a traditional gridview control the items inserted(bind) into the control are rows and the data is in columns. I have a customer who wants the data fields as rows and the columns as the items...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.