[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Exposing Inner Controls at Design Time

Mark Olbert

2/16/2007 3:28:00 PM

I'm building a custom control which is essentially a customized version of the Wizard control, although it doesn't derive from the
Wizard class. It's designed so that you can add a sequence of a limited number of types of steps to the control (e.g., an
Introduction step, a grid-select step). These are currently persisted as child controls of the custom control.

I'm curious as to "best practices" regarding several issues:

1) It occurred to me I could, instead of persisting child controls, persist the information needed to create child controls as
complex properties of the custom control. I would then use that information to create the child controls when needed. Right now the
child controls are added by AddParsedSubObject() to a private list, and then added to Controls during CreateChildControls(). That
seems like it would be more memory intensive than simply storing the information and creating the child controls on demand.

On the other hand, when I tried to persist a complex property I ended up having to prefix it with the tag prefix in the page markup
(e.g., "<cc1:ComplexProperty>"). I find this ugly. But while using a custom builder lets me avoid it for child controls, there
doesn't seem to be a way to attach a "custom property builder" to the defining class for a complex property.

2) I'd like to expose the list of child controls at design-time in the property panel the way the Wizard exposes WizardSteps. But if
I do that, how do I get changes propagated back to the page markup (the child controls are persisted within the markup for the
control)? I don't see how that would happen if I just expose the (currently hidden) list of child controls as a public property.
Does doing this involve creating a design-time only property in the control designer, and then working some magic to propagate
controls back to markup?

- Mark
2 Answers

wawang

2/19/2007 11:34:00 AM

0

Hi Mark,

Regarding all your posts about design-time support in ASP.NET, I will need
some time to do some research and get back to you as soon as possible. I
appreciate your patience and understanding.


Sincerely,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/de....
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

wawang

2/20/2007 5:58:00 AM

0

Hi Mark,

For your first question:

If you don't want to use "<cc1:ComplexProperty>", you're right that you
will have to use a custom ControlBuilder to parse that information. You
simply override ControlBuilder.GetChildControlType to return the type of
your custom control. The returned type of a class is responsible to parse
the child content markup. For example, "<Color value="Red" />" will only
need a simple class which has a public string property Value. Then in your
control's AddParsedSubObject, you simply check the type and use the parsed
simple class instance to build your control tree. To generate the simplied
inner HTML using your markup syntax, you need to create a custom
ControlDesigner and override GetPersistInnerHTML.

For your second question:

Wizard.WizardSteps is using the CollectionEditor. Again,
GetPersistInnerHTML (see previous question) should return be suffice to
return the inner markup. You don't have to do anything magical if you're
using this CollectionEditor.


For both of your questions, Mike Ellison has an excellent example for your
reference:

#ASP.NET Color DropDown Control - The Code Project - ASP.NET
http://www.codeproject.com/aspnet/HtmlColorDr...


Hope this helps.


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.