How to generate complex custom control

D

Dennis M

Hey everyone,

I am curious what the performance impact of a custom control would be if it
had a significant hierarchy of children. For example, 40 child controls, 5
levels deep, each control on average has 20 properties. What would be the
best way to implement such a thing?

The book I am reading uses templated controls and basically reconstructs the
entire hierarchy everytime page is accessed based on the tags in the .aspx
file, but books example only has 2 child controls. Would it make sence to
use xml configuration file instead of template elements? Would it be
possible to read the xml file once, build the hierarchy and then save it
somewhere, so that it is only regenerated when xml file changes? I was
thinking taking the root element and storing it in application cache, or
even serializing it to disk, but I am not sure if controls are allowed to be
reused for subsequent requests.

So anyone know the proper way such situation would be handled?

Oh yeah, I was thinking placing the whole thing into a user control and
making it cachable, but control would still be regenerated if it has to
process post-back events, right?

Thanks for any info

-- Dennis
 
D

Dennis M

Hey Steven,

Thanks for the response, I think I will end up some sort of variation
of what you suggested.

But what I was really curious about if instead of caching text
(control output as HTML), can I build the control object tree once and
then take the top object and put it into application cache. I've
tried something similar with a drop-down box that I initialized by
reading an XML file and it seems to be working, but I don't know if it
is legal, or what complication I could expect.

Actually as I am writing this, I just thought of one: if the control
hierarchy is shared and 2 users postback at the same time, the same
controls will probably be initialized with postback data, if there is
postback data. So that probably won't be good. But what if there is
no postback data and all control data members are common for all users
(and maybe changed at some point at the application level), then maybe
it is legal.

What do you think?

Another question to you or anyone who knows this. You probably can't
cache pure text HTML output if control has to process post-backs
because if you use the cache, objects don't get instantiated and
therefore they can't process the postbacks (or events), right?

Thanks,

-- Dennis
 
S

Steven Cheng[MSFT]

Hi Dennis,

Well, I agree with you on cached the control structure instances rather
than plain html string. Also that'll be ok if the control's structure is
shared by all users and won't be critical on personalization issues. In
addtion, as for the following issues on post back when caching the
htmloutput:
=========================
Another question to you or anyone who knows this. You probably can't
cache pure text HTML output if control has to process post-backs
because if you use the cache, objects don't get instantiated and
therefore they can't process the postbacks (or events), right?
=========================

Yes, this will cause the post back not work. I just forget this problem.
Thanks for your noticing.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top