Datagrid Binding Question

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

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

In Regards to ASP.NET/ADO.NET

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.
 
Hi Mike,

you can accomplish this by binding a datagrid (or list etc) to a distinct
list of the provider_IDs you want to use.

then within that control, you have another control, for example, a
radiobuttongroup. the datasource is bound to a function which returns a
view that is filtered to only contain the provider_id's for that row.
Something like:
public DataView getScoresModulesPerModule( object ModuleID)

{

dataSetAssessmentAttempts1.tblSatAssessment.DefaultView.RowFilter = (
"ModuleID = " + ModuleID.ToString() );

return dataSetAssessmentAttempts1.tblSatAssessment.DefaultView;

}


When you call DataGrid1.DataBind() for the first control, the
radiobuttongroups will be databound as well.

You'll need to set the buttons to autopost back, you'll need to store which
button was selected and provide a method for restoring which radio buttons
have been selected or deselected (possibly an array held in the viewstate??
.. That done you can bind the .selected (or what ever it's called) property
to a faction which returns true or false based on the contents of the radio
button.

Hope that this helps.

Craig
 
Back
Top