RE: custom container control - wrapping child controls



Hi Gerry,

How are you doing?

Regarding on this issue, I've performed some further research and discussed
with some other ASP.NET engineers.

So far we can think of one way to achieve this, but I think it is total
overkill. Whenever your template is persisted (when GetPersistenceContent()
is called), you could examine your control tree and modify it to make sure
it contains the container controls. You could then persist that control
tree into text, then re-parse it into an ITemplate and set your property to
that value. Then when ASP.NET persists your template it'll persist the
modified template.

Some scenarios that are a bit similar to this are that the MultiView
control can only contain View controls. Similarly, WebPartZones can only
contain WebParts. You might want to dig into their designer and runtime
code to see how they handle this. I've used the reflector tool to inspect
the code abit and find some code logic for gettting the current inner
content of control. But may still need more effort on setting the content.

Have you got any progress on your side?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.


==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Content-Transfer-Encoding: 7bit
From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng [MSFT])
Organization: Microsoft
Date: Thu, 24 Jul 2008 07:43:56 GMT
Subject: RE: custom container control - wrapping child controls


Hi Gerry,

From your description, you're developing a custom server control which
contains some inner controls, and you want to make some certain kind of
nested subcontrols be wrapper with another control automatically at
design-time, correct?

I've performed some research on this. So far for nested controls, the
custom control itself should be set as "ParseChildren" as false so that
inner markup will be interpreted as control instances. I think you've also
ready done this, correct? Generally, for design-time custoimzation, we
have two tools:

1. A custom control designer

2. A custom control parser

So far I only got some interfaces for customzing the displaying html from
Control Designer , but not the inline markup of the control. Also,
controlbuilder seems focus on the nested control's parsing and population
at runtime. Is there are any particular requirement in your page or
control that it will need such an wrapper element? Maybe we can also look
for some other means on this.

I'll do some further research on this and inform you if I get any new
finding.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#noti
f
ications.

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/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "gerry" <germ2@xxxxxxxxxxxxxxxx>
Subject: custom container control - wrapping child controls
Date: Wed, 23 Jul 2008 09:41:31 -0400


I am trying to create a custom container control that will only ever
contain
a specific type of control.
At design time, when a control of a different type is added to the
container
I would like to wrap the control in the proper control type - which is
also
a container.

At design time I want to be able to turn this :

<my:container>
<asp:textbox />
</my:container>

into this :

<my:container>
<my:wrapper>
<asp:textbox />
</my:wrapper>
</my:container>

It is no problem to detect what type of object is being added to the
control
and I can do the wrapping easy enough for the rendered control , but I
can't
see how to change the physical markup as displayed in the designer and
stored in the .aspx file.

Webparts does something similar but it looks like the designer source has
not been made available.

Anyone know how to do this or have any ideas on how this might be done ?

Gerry






.



Relevant Pages

  • Re: Menu control Databinding problem using StaticItemTemplate
    ... When I pass a Container.DataItem it's always a MenuItem object. ... As for adding custom attributes to ASP.NET 2.0 Menu control, ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: GridView DataBind() Not Working
    ... code(CreateChildcontrols), the designer (of your toplevel custom control) ... it hasn't a designer associated like the top ... render the control manually. ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • RE: info
    ... Regarding on the creating a custom control contains GridView(with ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Custom content control
    ... I thought that there could be a way to register your content control, which renders as normal content control with arrow like Date Picker or Combo Box. ... also mapping between values and the xml file would have to be defined with the custom content control. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.office.developer.vba)
  • RE: Updating Design Time When Property Changes
    ... assign to the constituent control, if you do that in CreateChildControls, ... you will notice you don't need to do anything to update the designer since ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.aspnet)