Problem with nested Datalists

Discussion in 'ASP .Net' started by TheHach, Feb 1, 2006.

  1. TheHach

    TheHach Guest

    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...
     
    TheHach, Feb 1, 2006
    #1
    1. Advertising

  2. 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




    "TheHach" wrote:

    > 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...
    >
     
    =?Utf-8?B?RFdT?=, Feb 1, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg Fischer

    findcontrol to find in nested datalists

    Greg Fischer, Nov 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    730
    Greg Fischer
    Nov 16, 2004
  2. Marty U.

    nested datalists event bubble

    Marty U., Dec 1, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    434
    Marty U.
    Dec 1, 2004
  3. Sparky Arbuckle

    Nested Datalists

    Sparky Arbuckle, Aug 24, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    4,516
    Sparky Arbuckle
    Aug 24, 2005
  4. schapopa
    Replies:
    0
    Views:
    692
    schapopa
    Jan 5, 2006
  5. schapopa
    Replies:
    0
    Views:
    395
    schapopa
    Jan 5, 2006
Loading...

Share This Page