Abstract Base Page in .Net 2.0

A

ayende

I want to have a page that contains some UI & logic, and have a set of
pages that inherit from it, and provides minimal additional items.

The best scenario is that teach child page need to give the parent page
a drop down list with items and a couple of strings to match.

I would like to be able to use markup to do it, since it's a lot easier
this way, and there is really no behavior about the child pages.

Any ideas?
 
A

ayende

I did, but it's not really helpful, since I need to put _logic_ in the
base page, and only get very little different information from the
child page.
There isn't really a way to force a child page to implement a spesific
interface, like I can do with abstract base page.
 
K

Kevin Spencer

Use a Master Page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition
 
M

Mikeon

I've had the same problem. I thought that if I add protected field to
the base page and name it i.e.: DropDown1, and then in child pages add
a control on a form with the same ID, then it would be accessible in
the base page (it would not be null). It came out that it is not the
case. It was allways null.
I is possible that it was null because the child pages were using
master page, but I had no time to test it, so what I have done is
declared an abstract property DropDown1 in the base class and every
page that inherits from it, must override it by returning the concrete
instance of the DropDownList control.
In the base page I'm using this property.

If anyone has tested the approach I've described that hasn't worked for
me, please comment on this.
 
P

Patrice

Possible solutions not knowing what exactly you are after :

#1. Still double check master pages. You can have logic in master pages and
you can expose whatever you want to child pages. Have you tried ?

#2. Else you can also have a page that inherits from a base page. It should
cause no problem (you can even define this as a default in the web.config
file). Have you tried ?

#3. Finally some people are using user controls loaded into a "main" page.

Which point exactly causes a problem ? IMO the first step will likely to
double check your requirements before choosing the appropriate solution...
 
S

Scott Allen

I did, but it's not really helpful, since I need to put _logic_ in the
base page, and only get very little different information from the
child page.
There isn't really a way to force a child page to implement a spesific
interface, like I can do with abstract base page.

I'm not following you here - you can put logic in a MasterPage.
 

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
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top