[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Tom

1/8/2009 3:25:00 PM

Hi,

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
example...
<uc1:Menu>
<MenuItem Title="First Item"/>
<MenuItem Title="Sub Menu Header"><MenuItem Title="Sub Menu Item"/></
MenuItem>
<MenuItem Title="Last Item"/>
</uc1:Menu>

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 :-)

Cheers,
Tom
1 Answer

Alvin Bruney [ASP.NET MVP]

1/9/2009 2:07:00 AM

0

You can cache this however if you do, i'd suggest you cache at the global
level. Every user should not be allowed to cache her own menu objects, that
will cause scalability issues. However, if there is sensitive data in the
menus, you should not cache globally.

--
Regards,
Alvin Bruney

Auther Plug
OWC Blackbook now on download at www.lulu.com/owc

"Tom" <spam101449@hotmail.co.uk> wrote in message
news:c7b0203b-2063-452e-a81c-9c82d6b41a35@k1g2000prb.googlegroups.com...
> Hi,
>
> 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
> example...
> <uc1:Menu>
> <MenuItem Title="First Item"/>
> <MenuItem Title="Sub Menu Header"><MenuItem Title="Sub Menu Item"/></
> MenuItem>
> <MenuItem Title="Last Item"/>
> </uc1:Menu>
>
> 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 :-)
>
> Cheers,
> Tom