Dynamically Adding DataLists

Discussion in 'ASP .Net Web Controls' started by Nathan Sokalski, Nov 6, 2005.

  1. I have a page on which I want to display several sections each of which
    contain a list of names. I have two database tables, one of which contains
    the section headings, and the other contains the names and which section
    they belong to. I would like to use databinding to display this information,
    preferably using DataLists. However, because the number of sections will
    vary, the DataLists will need to be added dynamically. But because DataLists
    use templates, I do not know how to do this. All of the DataLists will have
    identical templates, but I do not know how to create the template when the
    DataList is added dynamically. Can someone help me here? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Nov 6, 2005
    #1
    1. Advertising

  2. Nathan Sokalski

    Guest

    You can create an array of datalist. you will have to also create a
    couple of functions that will return your template columns.

    Thanks
    Keith Lang
    Nathan Sokalski wrote:
    > I have a page on which I want to display several sections each of which
    > contain a list of names. I have two database tables, one of which contains
    > the section headings, and the other contains the names and which section
    > they belong to. I would like to use databinding to display this information,
    > preferably using DataLists. However, because the number of sections will
    > vary, the DataLists will need to be added dynamically. But because DataLists
    > use templates, I do not know how to do this. All of the DataLists will have
    > identical templates, but I do not know how to create the template when the
    > DataList is added dynamically. Can someone help me here? Thanks.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
     
    , Nov 7, 2005
    #2
    1. Advertising

  3. There are two problems with that. First, whether or not the DataLists came
    from an array or not is irrelevant, because they are going to be added to
    the Controls Collection. Second, my template is not made up of just columns.
    As I am assuming you know, a template can contain almost any ASP.NET
    controls that can be used anywhere else, and my templates will be more than
    just a set of columns. Any other ideas? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
    <> wrote in message
    news:...
    > You can create an array of datalist. you will have to also create a
    > couple of functions that will return your template columns.
    >
    > Thanks
    > Keith Lang
    > Nathan Sokalski wrote:
    >> I have a page on which I want to display several sections each of which
    >> contain a list of names. I have two database tables, one of which
    >> contains
    >> the section headings, and the other contains the names and which section
    >> they belong to. I would like to use databinding to display this
    >> information,
    >> preferably using DataLists. However, because the number of sections will
    >> vary, the DataLists will need to be added dynamically. But because
    >> DataLists
    >> use templates, I do not know how to do this. All of the DataLists will
    >> have
    >> identical templates, but I do not know how to create the template when
    >> the
    >> DataList is added dynamically. Can someone help me here? Thanks.
    >> --
    >> Nathan Sokalski
    >>
    >> http://www.nathansokalski.com/

    >
     
    Nathan Sokalski, Nov 8, 2005
    #3
    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. Jonathan Hollinger

    ASP.NET Processor Ignoring DataLists?

    Jonathan Hollinger, Aug 18, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    422
    Ken Cox [Microsoft MVP]
    Aug 19, 2003
  2. Paul Turley

    Embedded DataLists to show child records

    Paul Turley, Aug 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    445
    Paul Turley
    Aug 30, 2003
  3. Guest

    Repeaters, Datalists and Datagrids

    Guest, Nov 5, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    348
    Guest
    Nov 5, 2003
  4. Nathan Sokalski

    Dynamically Adding DataLists

    Nathan Sokalski, Nov 6, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    526
    Nathan Sokalski
    Nov 8, 2005
  5. Nathan Sokalski

    Dynamically Adding DataLists

    Nathan Sokalski, Nov 6, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    110
    Nathan Sokalski
    Nov 8, 2005
Loading...

Share This Page