VS.NET designer support for nested custom web form controls

C

Casper

I have a custom web form control, that can contain other custom
controls.
Is it possible to add designer support for this, so I can drag a
custom control onto another control?
 
J

John Saunders

Casper said:
I have a custom web form control, that can contain other custom
controls.
Is it possible to add designer support for this, so I can drag a
custom control onto another control?

Yes and no.

Your outer control could derive from Panel, for instance, in which case you
could drag other controls onto it in the same way as a Panel control works.

But it would be _exactly_ like a Panel control. If I remember correctly,
there is a trade-off between this "drag" behavior and the ability to have
your outer control do its own design-time rendering. I believe that the
designer will ignore your outer control designer's GetDesignTimeHtml method
and simply render the inner controls.

Alternatively, your outer control could support templates. You couldn't
directly drag controls onto it then, but you could enter template editing
mode and then drag controls into the template editing area.
 
C

Casper

John Saunders said:
Yes and no.

Your outer control could derive from Panel, for instance, in which case you
could drag other controls onto it in the same way as a Panel control works.

But it would be _exactly_ like a Panel control. If I remember correctly,
there is a trade-off between this "drag" behavior and the ability to have
your outer control do its own design-time rendering. I believe that the
designer will ignore your outer control designer's GetDesignTimeHtml method
and simply render the inner controls.
That solution would be good enought for me, I'll work a little bit
more with that idea.
Alternatively, your outer control could support templates. You couldn't
directly drag controls onto it then, but you could enter template editing
mode and then drag controls into the template editing area.
That could also be a good solution. Do you have some examples or
guides, something to get me started with templates.

Thanks for you reply :)
 
J

John Saunders

Casper said:
"John Saunders" <[email protected]> wrote in message
That could also be a good solution. Do you have some examples or
guides, something to get me started with templates.

Actually, no, I don't have an example handy. If I were you, I'd start with
the MSDN documentation.
 

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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top