web usercontrol as property of other classes possible?

A

Arthur Milfait

hey there,

i'd like to do some wild thing like this:

imagine a simple page with a navigation menu and an iframe. clicking
on links in the menu loads the according page in the iframe. the menu
is a web-usercontrol of type "MenuList" that uses web-usercontrols of
type "MenuItem" for each link. so far nothing special. but now i'd
like each page that can be loaded to be of an interface/type
"IMenuItem" that publishes a getter for the web-usercontrol of type
"MenuItem", that actually is inserted dynamically into the "MenuList"-
control.
This means ...
1. the page-object has to have a property of type web usercontrol that
is actually not a part of the control-collection of that page.
2. the page itself has to be instanciated somehow to be in some
collection or array of type "IMenuItem[]" in the "MenuList"-control.
are such things by any means possible? i could not figure out how to
do this, and i know how to dynamicaly load controls into other
controls and pages. but that is not what i want here.

why do i wnat to do such a weird thing anyway? the idea emerged out of
the simple wish to encapsulate code into the right classes, instead of
having an additional class that does all the interface-stuff for each
page or control. having the controls as properties in the objects that
own the data would tidy things up very much!

i would apprechiate any replies that either suggest how to do it or
asure me that this is not possible at all with the current concept of
asp.net or suggest a solution that is different but also helps me
straighten the class layout.

thanks in advance,
arthur
 

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

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top