Get Container Parent at Design Time

V

Valeria

I have many panels into a container(it´s also a panel).
I want to get the container´s id from the child panels at design time.

When I create these child panels from code I can get the containerID
easily:
Panel panel = new Panel();
Controls.Add(panel);

then:
Panel container = panel.Parent;

But at design time....
How can I get the Parent when I make the drag and drop of the panels
into the container from the designer class?

Thanks in advance,
 
V

Victor Garcia Aprea [MVP]

Hi Valeria,

What you're looking for is Control's Site property. From there you can get
to the container and its components, i.e.:

base.Site.Container.Components

If you're going to mess with design-time I highly recommend you to write a
control designer (take a look at the ControlDesigner class).
 
V

Victor Garcia Aprea [MVP]

Hi Valeria,

What you're looking for is Control's Site property. From there you can get
to the container and its components, i.e.:

base.Site.Container.Components

If you're going to mess with design-time I highly recommend you to write a
control designer (take a look at the ControlDesigner class).
 
V

Valeria

Hello Victor, how are you doing?
It worked perfectly well. (I'm alredy using the ControlDesigner class)
Thank you very much for your answer...
Saludos!, Valeria.
 
V

Victor Garcia Aprea [MVP]

Hi Valeria,

Glad I could help in solving that!

I don't recall where I know you from, sorry about that, maybe one of my
talks? a listserv?

saludos,
-V.
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top