ObjectDataSource/GridView with dynamic columns

J

Joel Krist

Hello,

I'm making use of the Wizard and GridView/ObjectDataSource webcontrols
and have some questions regarding working with dynamic GridView columns.

Here's my scenario - I have 3 wizard steps defined:

Step 1 displays a GridView that has 2 columns - a databound course name
column and a templated checkbox column.

Step 2 displays a GridView that has 2 columns - a databound accrediting
body column and a templated checkbox column.

Step 3 displays a GridView that needs to display the intersection of the
courses and accrediting bodies selected via checkbox in steps 1 and 2.
The user needs to be able to edit the data in the GridView and specify
credit values for each course/accrediting body. When the user hits the
Finish button the current state of the GridView will be persisted to the
database.

I've got the step 3 GridView successfully displaying a row for each
course selected in step 1. Each row of the step 3 GridView displays a
column for the course name and a column for each accrediting body
selected in step 2. I do this by creating a DataSet on the fly after the
completion of step 2. The dataset is then stuffed into session data so
that it is available to step 3.

The GridView in step 3 is bound to an ObjectDataSource that uses a very
simple business object whose SelectMethod returns the dataset created
after step 2.

Here are my questions:

1. How should I be getting at the dataset cached in session data from
the SelectMethod of my business object? Currently I have the
SelectMethod accepting the DataSet as a parameter from the
ObjectDataSource which gets the dataset from the session variable. This
seems kind of silly though since the SelectMethod simply turns right
around and returns the passed dataset. I don't see any way to get at
session data directly from the business object though.

2. The user needs to be able to update the data displayed in the step 3
GridView. The problem I'm running into is that I don't know in advance
how many columns the step 3 GridView will contain since it's dependent
on how many accrediting bodies were selected in step 2. What would the
signature of the UpdateMethod on the business object look like?

I hope this makes sense. I'm trying to determine if what I'm attempting
to do is possible and if so how I can handle doing updates with a
GridView that contains a dynamic number of columns.

Thanks for any ideas/pointers.

Joel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top