Problem with nested Datalists

T

TheHach

Hi.

(For information, i'm working in VB.NET)

In our company, we have material that is divided into 3 parts :
- a system
- a batch
- an article

In each system are different batches, and in each batch different
articles.

So, in a webpage, I have to show our material like this :

(+) System 1
(+) Batch 1
Article 1
Article 2
(+) Batch 2
Article 3
Article 4
(+) Batch 3
(+) System 2
.....

So that when the user clicks on the (+) before the system or the batch,
it develops the list of batches or articles.
I tried to do this with nested datalists.
So, I have a main datalist where are listed the systems. In the
SelectedItemTemplate of this datalist, I've a second datalist which
lists the batches of the system. And in the SelectedItemTemplate of this
second datalist, I've the third which lists the articles of the selected
batch.
In our database, the three types of material are in the same table. They
are differentiated thanks to 3 columns : POSITION_C (position of the
system in the list), POSITION_D (position of the batch, or null if it's
only a system) and POSITION_E (position of the article, or null if it's
a system or a batch).
In my first datalist, I list the systems with a dataset which contains
all the material where position_d and position_e are null.
In the second datalist, the datasource is a function (GetDetailsD) where
there is an argument : the position_c of the current system.
The code is the following : DataSource='<%# GetDetailsD(DataBinder.Eval
(Container, "DataItem.POSITION_C")) %>'
In the third datalist, the datasource is another function (GetDetailsE
where the arguments are the position_c and the position_d of the current
batch. The code is : DataSource='<%# GetDetailsE(DataBinder.Eval
(Container, "DataItem.POSITION_C"),DataBinder.Eval(Container,
"DataItem.POSITION_D")) %>'

When I launch my page, the systems are correctly listed. When I click on
a (+) before a system, it shows me the correct batches that compose this
system. But when I click on a (+) before a batch to show the articles,
the line of the batch disappears. The problem comes from the datasource
of my second datalist : when I replace the argument of my function
GetDetailsD (i.e. DataBinder.Eval(Container, "DataItem.POSITION_C")) by
a number (2, or 4, or ...), it works fine. It's only when the argument
is DataBinder.Eval(Container, "DataItem.POSITION_C")....
What am I doing wrong ???

Thanks for help...
 
G

Guest

TheHatch,
For information I'm a VB.Net coder. You could have done that with a
treeview control and a custom IHierarchicalDataSourceControl, Heres the
bonus you can bind a menucontrol to the same datasource if you go that way.

Take a look at this one.
http://msdn2.microsoft.com/en-us/library/system.web.ui.hierarchicaldatasourcecontrol.aspx

If you decide to and find you need help with the
hierarchialdatasourcecontrol let me know by reply to thread or group.

Good Luck

DWS
Check out my ASP.Net 2.0 webparts and custom application providers
www.dws400.com
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top