473,503 Members | 8,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to generate complex custom control

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
Nov 18 '05 #1
3 1915
Hi Dennis,

From your description, you're wanting do generate a complex custom control
which has huge amount of sub elements and also deep hierarchy. Since
normally all the server controls on the page will be reconstrucuted when
the page is requested and loaded on the serverside, you're wondering some
means to improve the performance, yes?

I think the behavior that a server control is recontructed at serverside
when processing its contaier page is unavoidable. Everytime the page is
processing on the severside, it'll first reconstructor the Control
hierarchy and mapping their viewstates to them(if is post back). If you
want to avoid this, one way is to use the Cache function in ASP.NET, and I
think the means that use xml configuration file to store the controls'
strucutre info and restructure the control whenever the file is modifed you
mentiond is reasonable. In ASP.NET 's serverside cache feature, there is
one means to help cache the page's output depend on a file on the
serverside , the page will be construcuted( all its controls) the first
time it is request , after that if we request the page again, the page's
ouput will be the plain html values which is output the first. And this
cache will remain until the dependent file is modified. For detailed info,
you can view the following reference in MSDN:

#ASP.NET Caching Features
http://msdn.microsoft.com/library/en...achingfeatures
..asp?frame=true

#@Caching Page Output with File Dependencies
http://msdn.microsoft.com/library/en...ingpageoutputw
ithfiledependencies.asp?frame=true

Also, if you don't want to cache a whole page. I think you can manually
implement the control's file denpendent caching in your control's
construcut code. For example, you can generate the control's structure and
render it out the first time and store the output in the Application.Cache,
and the cahe is file dependent, then the next time the control will check
the applcation cache, if exist retrieve the cache and output it rather than
reconstrucure the whole control. How do you think of this? Also, I think
we may wait for some one else's suggestions. Thanks.

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
Nov 18 '05 #2
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
v-******@online.microsoft.com (Steven Cheng[MSFT]) wrote in message news:<nm**************@cpmsftngxa10.phx.gbl>...
Hi Dennis,

From your description, you're wanting do generate a complex custom control
which has huge amount of sub elements and also deep hierarchy. Since
normally all the server controls on the page will be reconstrucuted when
the page is requested and loaded on the serverside, you're wondering some
means to improve the performance, yes?

I think the behavior that a server control is recontructed at serverside
when processing its contaier page is unavoidable. Everytime the page is
processing on the severside, it'll first reconstructor the Control
hierarchy and mapping their viewstates to them(if is post back). If you
want to avoid this, one way is to use the Cache function in ASP.NET, and I
think the means that use xml configuration file to store the controls'
strucutre info and restructure the control whenever the file is modifed you
mentiond is reasonable. In ASP.NET 's serverside cache feature, there is
one means to help cache the page's output depend on a file on the
serverside , the page will be construcuted( all its controls) the first
time it is request , after that if we request the page again, the page's
ouput will be the plain html values which is output the first. And this
cache will remain until the dependent file is modified. For detailed info,
you can view the following reference in MSDN:

#ASP.NET Caching Features
http://msdn.microsoft.com/library/en...achingfeatures
.asp?frame=true

#@Caching Page Output with File Dependencies
http://msdn.microsoft.com/library/en...ingpageoutputw
ithfiledependencies.asp?frame=true

Also, if you don't want to cache a whole page. I think you can manually
implement the control's file denpendent caching in your control's
construcut code. For example, you can generate the control's structure and
render it out the first time and store the output in the Application.Cache,
and the cahe is file dependent, then the next time the control will check
the applcation cache, if exist retrieve the cache and output it rather than
reconstrucure the whole control. How do you think of this? Also, I think
we may wait for some one else's suggestions. Thanks.

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

Nov 18 '05 #3
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

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1732
by: Lut | last post by:
Hey, I made a custom usercontrol (Custom listview) in the Control Library. Now I want in the properties of design a property 'Sort'. (That is not a problem to do that) But, when it is Yes...
3
253
by: Dennis M | last post by:
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...
1
2704
by: Dot net work | last post by:
Hello. I have an interesting data binding scenario: I have a repeater control. It repeats a typical custom web user control. I also have a collection object, and each collection element...
1
2312
by: A Traveler | last post by:
Hello, i am having this problem. The exact error message is: "Unable to generate code for a value of type 'System.Web.UI.Page'. This error occurred while trying to generate the property value for...
5
3461
by: Trail Monster | last post by:
Ok, I've been searching the net now for several days and can't find how to do this anywhere. Version: VS 2005 Professional Release, 2.0 Framework Background: I have a complex business object...
3
1195
by: Bernie Yaeger | last post by:
I'm trying to create a custom control that has 2 listviews, in view smallicon. I'm using these with code that makes them drag/drop controls, so what I am after is a control that does drag/drop...
1
6091
by: Jeremy Chapman | last post by:
I have a property will an array of webcontrols. The control features a custom property editor which can add and remove web controls to the array, but how do I persist the informtion by...
0
1316
by: Iain | last post by:
Can I apologise for the lengthy nature of this post. The scenario is complicated (though I hope the solution is not!) basically, I've got a custom template control which binds itself to a tree...
6
2658
by: junk | last post by:
Senerio: I have a custom user control which contains two control arrays. The user control has a group box in which the two control arrays are dynamically built. The two control arrays are...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.