473,402 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Can't derive from abstract web page

Hi!

I have a abstract base class that derives from System.Web.UI.Page. In this
class I have some abstract methods.
My other web pages should derive from this class and implement the abstract
methods. When I try to display the derived web page in the designer I get an
error:
" The file could not be loaded into the Web Forms designer. Please correct
the following error and then try loading it again:

Type Abstract

Make sure...."

It seams that a web page can not derive from a abstract class, is it really
so?

Thanks in advance.

/Henke
Nov 18 '05 #1
4 1306
> It seams that a web page can not derive from a abstract class, is it
really
so?


Yes and no :-)

It can descend from the abstract class, but the designer always creates an
instance of the parent class (which is abstract). You can design your pages
using HTML but not the WYSIWYG designer.

Instead of making your page abstract you could implement the abstract
methods and just throw an exception. Although unimplemented "abstract"
methods will then surface at runtime rather than compile time, so you may
not want to do this. Personally, I'd stick to the HTML editor anyway (and
do).
--
Pete
====
Audio compression components, DIB graphics controls, FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com
Nov 18 '05 #2
Ok, that answers my question anyway, but I think it's quite odd though...
Thanks!

/Henke

"Peter Morris" <pe**@removethisbit.droopyeyes.com> skrev i meddelandet
news:eG**************@TK2MSFTNGP11.phx.gbl...
It seams that a web page can not derive from a abstract class, is it really
so?


Yes and no :-)

It can descend from the abstract class, but the designer always creates an
instance of the parent class (which is abstract). You can design your

pages using HTML but not the WYSIWYG designer.

Instead of making your page abstract you could implement the abstract
methods and just throw an exception. Although unimplemented "abstract"
methods will then surface at runtime rather than compile time, so you may
not want to do this. Personally, I'd stick to the HTML editor anyway (and
do).
--
Pete
====
Audio compression components, DIB graphics controls, FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

Nov 18 '05 #3
> Ok, that answers my question anyway, but I think it's quite odd though...

Well, it makes sense if you think about it. To represent a page the page
the designer must start from something which is compiled and then decorate
it with your additional HTML. It can't compile each time because whenever
you had an error in your code behind you wouldn't be able to design your
page. So, it shows the most recent ancestor class to ensure everything
looks the way it should before decorating, unfortunately your ancestor class
is abstract.
--
Pete
====
Audio compression components, DIB graphics controls, FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com
Nov 18 '05 #4
The good news is, it is working in VS2005 beta 1 with no problem - not
that it solves today's problems, but something to look forward to.

--
Scott
http://www.OdeToCode.com

On Fri, 13 Aug 2004 12:20:18 +0100, "Peter Morris"
<pe**@removethisbit.droopyeyes.com> wrote:
Ok, that answers my question anyway, but I think it's quite odd though...


Well, it makes sense if you think about it. To represent a page the page
the designer must start from something which is compiled and then decorate
it with your additional HTML. It can't compile each time because whenever
you had an error in your code behind you wouldn't be able to design your
page. So, it shows the most recent ancestor class to ensure everything
looks the way it should before decorating, unfortunately your ancestor class
is abstract.


Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Quentin | last post by:
Dear Gurus, This is a fairly simple question, but I can't figure out what the answer is. I can easily change my code, but I want to know why I can't do this to further my knowledge of the C++...
8
by: Zheng Da | last post by:
I don't know where should I ask the question, so send the email to this group. I choose this group, because I want to write the program with c++ :) I want to write a program which support...
3
by: Marcin Kowalewski | last post by:
Hi I've got a stupid problem with code below : using System; using System.Drawing; .... public class CsrcImage :Image { public CsrcImage() { //
1
by: Richard Thomas | last post by:
Hi, I've got an .aspx page with a number of controls on it for setting the values for an object. When the values have been put in, the user clicks on the "Store" button. When I want to edit...
13
by: Stephen Walch | last post by:
Error C2392 is hitting me hard! I have a managed C++ library that implements a bunch of fixed interfaces. For example, one interface is: public abstract interface IDbCommand { public...
2
by: Doug | last post by:
I am trying to work with an object and create it like so: EXTRA.Sessions oSessions = new EXTRA.Sessions(); This doesn't work because I get this error: 'Cannot create an instance of the...
1
by: Murray Gill | last post by:
Our current solution has a number of ASP.NET pages with very similar functionality. We would like to move the common functions into a base class that inherits from System.Web.UI.Page, and then force...
3
by: craig | last post by:
Given two existing but different classes OldA and OldB (that can not be made to derive from any new base class); is there a way to make them both "observer" objects so that they can be put in one...
0
by: Alexander Mueller | last post by:
Owen Blacker schrieb: Something that is static just exists once. If you could override or derive it, you would create it for a second time. See it like this:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.