Hierarchical binding in a WebServer Control with templates

Discussion in 'ASP .Net Building Controls' started by Iain, Jun 15, 2004.

  1. Iain

    Iain Guest

    I want to build a templated control which will be the graphical
    representation of a complex object.

    So the object has a list of items (line items on an order) and some items
    can contain other items (specifically, some items can be custom CDs with
    individual tracks on).

    So I when I come to render I want to bind to the object and enumerate
    through the collection. But when I come to an item which contains other
    items I want to use a different set of templates, specifically with
    templates for each sub item.

    I sort of understand templated databinding, but I'm struggling with the
    relationship between CreateControls and Render on this one.

    Any advice out there?

    Iain, Jun 15, 2004
    1. Advertisements

  2. Sure, you could have a template for an item and one for subitems. If
    necessary, you could have a template for each kind of subitem. Just add an
    ITemplate property for each possible kind of subitem.
    John Saunders, Jun 15, 2004
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.