473,473 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Binding certain rows to certain columns in GridView?

I'm not sure if there is a way to do this...I have data coming back in
rows for various currencies. I need to split out the data in a
GridView so that all the rows for one currency appears in that
currency's column, i.e.
item 1 through 4 are EUR, item 5 through 8 are GBP, etc. etc.
EUR GBP USD
item1 100
item 2 200
item 3 300
item 4 500
item 5 250
item 6 450
item 7 870
item 8 890
item 9 106
item 10 115 etc.

I also need to remove a column if there are no entries for that
currency, i.e. if no data comes back for EUR then I must hide the EUR
column.

Is there an easier way to do this than on the rowdatabind event
looping through each column checking each time and working out what
cell to put data into? Is there a way to bind a column to a fieldname
and a currency and not just the fieldname?
Mar 25 '08 #1
2 1652
If the data is coming from a db, adjust the sql to produce the results you
want.

<be************@gmail.comwrote in message
news:80**********************************@s8g2000p rg.googlegroups.com...
I'm not sure if there is a way to do this...I have data coming back in
rows for various currencies. I need to split out the data in a
GridView so that all the rows for one currency appears in that
currency's column, i.e.
item 1 through 4 are EUR, item 5 through 8 are GBP, etc. etc.
EUR GBP USD
item1 100
item 2 200
item 3 300
item 4 500
item 5 250
item 6 450
item 7 870
item 8 890
item 9 106
item 10 115 etc.

I also need to remove a column if there are no entries for that
currency, i.e. if no data comes back for EUR then I must hide the EUR
column.

Is there an easier way to do this than on the rowdatabind event
looping through each column checking each time and working out what
cell to put data into? Is there a way to bind a column to a fieldname
and a currency and not just the fieldname?
Mar 25 '08 #2
normally you'd pivot the data first, then display nulls as blank (simple
formatter). you can pivot in the original query, or google ado.net pivot for
sample code. you can easily create a new datatable, and pivot the rows.

-- bruce (sqlwork.com)
"be************@gmail.com" wrote:
I'm not sure if there is a way to do this...I have data coming back in
rows for various currencies. I need to split out the data in a
GridView so that all the rows for one currency appears in that
currency's column, i.e.
item 1 through 4 are EUR, item 5 through 8 are GBP, etc. etc.
EUR GBP USD
item1 100
item 2 200
item 3 300
item 4 500
item 5 250
item 6 450
item 7 870
item 8 890
item 9 106
item 10 115 etc.

I also need to remove a column if there are no entries for that
currency, i.e. if no data comes back for EUR then I must hide the EUR
column.

Is there an easier way to do this than on the rowdatabind event
looping through each column checking each time and working out what
cell to put data into? Is there a way to bind a column to a fieldname
and a currency and not just the fieldname?
Mar 25 '08 #3

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

Similar topics

0
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
3
by: mateo | last post by:
Hello, I have a GridView inside which i want to show 3 dropdownList (one for each Column). So i've created 3 TemplateField Continent Country City
4
by: Mike | last post by:
I'm having trouble getting a gridview to bind. I probably missing something completely obvious and would appreciate any help on offer. I'm passing parameters via querystring, and have created a...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
1
by: MikeB | last post by:
ooh boy, I hope I'm in the right place to ask this. I'm trying to do a class project that binds controls to data sources. I have a Drop-down List that I bound to the Author column of an SQL...
2
by: Blasting Cap | last post by:
I've got a gridview (that I converted over from a datagrid, which had been working properly), that is doubling up the number of rows returned. When it was running as a datagrid, the same code sent...
1
by: tucson | last post by:
I have a gridview that has a blank row with 2 input fields: file to upload, and a description of the file. They click Add and a new row is added, Remove and the row is removed. The problem is:...
3
by: RobertTheProgrammer | last post by:
Hi folks, I've got another problem. Basically, I'm trying to use a nested GridView, however the nexted GridView displays no values (even though in debug I'm getting valid values into my DataSet. ...
1
BeemerBiker
by: BeemerBiker | last post by:
I converted an arraylist to a dataset and bound the dataset to a gridview but I cannot change the value of the checkbox in the gridview. I identified the DataKeyNames and made sure that ReadOnly was...
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
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...
1
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,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.