469,602 Members | 1,645 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Datagrid/Datalist - Multiple Rows as one questions.

Hi!
Been stuck on this one for a bit. Would really appreciate any help on
this one.

To start. I have a sql database table with the following data and
design (ex)

------------------------------------
provider_id | plan_id | plan cost
------------------------------------
1 US-1 20.00
1 US-2 30.00
1 US-3 40.00
2 UK-1 10.00
2 UK-2 20.00
2 UK-3 32.00

I need to display this in a way (DataGrid, DataList, etc...)
where I can view all provider items on the same, line and select a
plan
using a radiobuttonlist or similar.

I'm not sure if it is something I need to do in the database query or
something
at the application level.

It will need to look something like this:

------------------------------------------
provider_id | plan_1 | plan_2 | plan 3
------------------------------------------
1 20.00 30.00 40.00
2 10.00 20.00 32.00

I would like the to be able to select a dollar amount(by radiobutton
if possible) and have the plan_id as the value if possible.

Has anybody got something like this working.
Nov 18 '05 #1
1 2000
There are quite a few ways to accomplish this. This is one potential
solution. First off, some observations and assumptions.

You are titling your result table with a string that is not included in
your schema. I assume this will be a label like "Plan " & x, which x is an
incrementing number. I also assume you are dealing with the same number of
plans for each provider, although this would become an issue later if the
providers offer differing numbers of plans.

I do not know if you need to select one plan per provider or one plan among
all providers.

So, one way to accomplish this is to have a repeater control loop through a
distinct list of provider IDs. I will assume this is in a table and
providerID is the primary key.
Within each Repeater item template, use a radio button list with horizontal
orientation to display the plas for the current provider ID. This can be
done by bringing in all the plans and using a dataview to filter the plans
by provider ID and bind to the list.

Here's some psudeoCode:
(dt=datatable, dac=Data access component [you do have a data access layer,
right?], rpt=repeater, rbl=radiobuttonlist, dv=dataview)

' Get providers
dtProviders=dacProvider.Getproviders()

' get plans
dtPlans=dacPlans.GetAllPlans()

' Bind Providers to Repeater
with rptProviders
.datasource=dtproviders
.databind
end with

' in Handler for rptProviders.ItemDataBound
' Get the radiobuttonlist in the repeater Item template
rblPlans=ctype(e.item.findcontrol("rblPlans"),radi obuttonlist)

' Filter the plans datatable by the current Provider ID
with dvPlans
.table=dtplans
.rowfilter="provider_id=" & _
ctype(e.item.dataitem,datarowview).item("ID")
end with

' bind the filtered list
with rblPlans
.datasource=dvPlans
.databind
end with

You will have to tweak some of the settings as you go, but I think this
will get you started in the right direction. If not, there's always the
crosstab technique. That can be done in a SQL Stored Procedure using
dynamic SQL.

Best of luck!

mi***********@comcast.net (Mike) wrote in news:5967eef5.0410131151.75a68038
@posting.google.com:
Hi!
Been stuck on this one for a bit. Would really appreciate any help on
this one.

To start. I have a sql database table with the following data and
design (ex)

------------------------------------
provider_id | plan_id | plan cost
------------------------------------
1 US-1 20.00
1 US-2 30.00
1 US-3 40.00
2 UK-1 10.00
2 UK-2 20.00
2 UK-3 32.00

I need to display this in a way (DataGrid, DataList, etc...)
where I can view all provider items on the same, line and select a
plan
using a radiobuttonlist or similar.

I'm not sure if it is something I need to do in the database query or
something
at the application level.

It will need to look something like this:

------------------------------------------
provider_id | plan_1 | plan_2 | plan 3
------------------------------------------
1 20.00 30.00 40.00
2 10.00 20.00 32.00

I would like the to be able to select a dollar amount(by radiobutton
if possible) and have the plan_id as the value if possible.

Has anybody got something like this working.


Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Soul | last post: by
1 post views Thread by Craig Banks | last post: by
2 posts views Thread by Simon Harris | last post: by
9 posts views Thread by tshad | last post: by
1 post views Thread by sri_san | last post: by
1 post views Thread by Brock | last post: by
1 post views Thread by Brock | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.