Caching parsed child elements

Discussion in 'ASP .Net Building Controls' started by Tom, Jan 8, 2009.

  1. Tom

    Tom Guest


    A slightly complex one, I hope I explain it clearly...

    I have a usercontrol which use the ParseChildren(False) and
    ControlBuilder attributes.
    The usercontrol is called from the parent page using the following
    <MenuItem Title="First Item"/>
    <MenuItem Title="Sub Menu Header"><MenuItem Title="Sub Menu Item"/></
    <MenuItem Title="Last Item"/>

    Everything is working fine - the usercontrol is calling the
    AddParsedSubObject, the GetChildControlType of the Builder is being
    called, the MenuItem objects are created with all their attributes...
    all hunky-dory.
    (Although I don't quite understand exactly when the system calls
    GetChildControlType, as it doesn't always appear to break-point when
    I'd expect it to!)

    My question is whether it is possible to cache those MenuItem objects,
    and use them instead of the AddParsedSubObject being called every
    single time the page is loaded.
    The menus I have are quite large, and it's a waste of processing to
    create the MenuItems objects everytime.

    Any help, or suggestions of different approaches, very welcome :)

    Tom, Jan 8, 2009
    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.