Problem with nested Datalists

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TheHach

    Problem with nested Datalists

    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
    SelectedItemTem plate of this datalist, I've a second datalist which
    lists the batches of the system. And in the SelectedItemTem plate 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(Dat aBinder.Eval
    (Container, "DataItem.POSIT ION_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(Dat aBinder.Eval
    (Container, "DataItem.POSIT ION_C"),DataBin der.Eval(Contai ner,
    "DataItem.POSIT ION_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.POSIT ION_C")) by
    a number (2, or 4, or ...), it works fine. It's only when the argument
    is DataBinder.Eval (Container, "DataItem.POSIT ION_C")....
    What am I doing wrong ???

    Thanks for help...
  • DWS

    #2
    RE: Problem with nested Datalists

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

    Take a look at this one.


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

    Good Luck

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





    "TheHach" wrote:
    [color=blue]
    > 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
    > SelectedItemTem plate of this datalist, I've a second datalist which
    > lists the batches of the system. And in the SelectedItemTem plate 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(Dat aBinder.Eval
    > (Container, "DataItem.POSIT ION_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(Dat aBinder.Eval
    > (Container, "DataItem.POSIT ION_C"),DataBin der.Eval(Contai ner,
    > "DataItem.POSIT ION_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.POSIT ION_C")) by
    > a number (2, or 4, or ...), it works fine. It's only when the argument
    > is DataBinder.Eval (Container, "DataItem.POSIT ION_C")....
    > What am I doing wrong ???
    >
    > Thanks for help...
    >[/color]

    Comment

    Working...