ASP.NET Page inheritence

Discussion in 'ASP .Net' started by =?Utf-8?B?Ym1zZ2hhcnI=?=, Aug 21, 2005.

  1. On a web site that I am working on I have created a base page called
    public abstract class WebsiteBasePage : System.Web.UI.Page
    {
    .....
    }

    The reason for this is to put standard code in it, for example retrieving
    application settings from web.config, but each time I try to open a decendant
    page

    public class Default : WebsiteBasePage
    {
    ....
    }

    I get the following error when I open the page up to design the HTML side of
    things:

    ---------------------------
    Microsoft Development Environment
    ---------------------------
    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 all of the classes used in the page are built or referenced in the
    project. Click Help for more information.
    ---------------------------
    OK Help
    ---------------------------

    The base class WebsiteBasePage is in the same namespace as default.aspx.
    This is the page inheritence tag in the aspx file.
    <%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false"
    Inherits="StandardSnowdropORS.Default" %>

    TIA
    Graham Harris
     
    =?Utf-8?B?Ym1zZ2hhcnI=?=, Aug 21, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?Ym1zZ2hhcnI=?=

    Scott Allen Guest

    This is a limitation in VS 2003, WebsiteBasePage must have the
    "abstract" keyword applied on the class or on a method. If you want to
    use the designer you'll have to make the class concrete, i.e.
    non-abstract, i.e. provide a default implementation for all of the
    class members.

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

    On Sun, 21 Aug 2005 00:34:01 -0700, "bmsgharr"
    <> wrote:

    >On a web site that I am working on I have created a base page called
    >public abstract class WebsiteBasePage : System.Web.UI.Page
    >{
    >....
    >}
    >
    >The reason for this is to put standard code in it, for example retrieving
    >application settings from web.config, but each time I try to open a decendant
    >page
    >
    >public class Default : WebsiteBasePage
    >{
    > ....
    >}
    >
    >I get the following error when I open the page up to design the HTML side of
    >things:
    >
    >---------------------------
    >Microsoft Development Environment
    >---------------------------
    >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 all of the classes used in the page are built or referenced in the
    >project. Click Help for more information.
    >---------------------------
    >OK Help
    >---------------------------
    >
    >The base class WebsiteBasePage is in the same namespace as default.aspx.
    >This is the page inheritence tag in the aspx file.
    ><%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false"
    >Inherits="StandardSnowdropORS.Default" %>
    >
    >TIA
    >Graham Harris
     
    Scott Allen, Aug 21, 2005
    #2
    1. Advertising

  3. Thanks that worked..

    Graham Harris

    "Scott Allen" wrote:

    > This is a limitation in VS 2003, WebsiteBasePage must have the
    > "abstract" keyword applied on the class or on a method. If you want to
    > use the designer you'll have to make the class concrete, i.e.
    > non-abstract, i.e. provide a default implementation for all of the
    > class members.
    >
    > --
    > Scott
    > http://www.OdeToCode.com/blogs/scott/
    >
    > On Sun, 21 Aug 2005 00:34:01 -0700, "bmsgharr"
    > <> wrote:
    >
    > >On a web site that I am working on I have created a base page called
    > >public abstract class WebsiteBasePage : System.Web.UI.Page
    > >{
    > >....
    > >}
    > >
    > >The reason for this is to put standard code in it, for example retrieving
    > >application settings from web.config, but each time I try to open a decendant
    > >page
    > >
    > >public class Default : WebsiteBasePage
    > >{
    > > ....
    > >}
    > >
    > >I get the following error when I open the page up to design the HTML side of
    > >things:
    > >
    > >---------------------------
    > >Microsoft Development Environment
    > >---------------------------
    > >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 all of the classes used in the page are built or referenced in the
    > >project. Click Help for more information.
    > >---------------------------
    > >OK Help
    > >---------------------------
    > >
    > >The base class WebsiteBasePage is in the same namespace as default.aspx.
    > >This is the page inheritence tag in the aspx file.
    > ><%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false"
    > >Inherits="StandardSnowdropORS.Default" %>
    > >
    > >TIA
    > >Graham Harris

    >
    >
     
    =?Utf-8?B?Ym1zZ2hhcnI=?=, Aug 21, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Doug Nichols

    Inheritence question

    Doug Nichols, Feb 19, 2004, in forum: Perl
    Replies:
    0
    Views:
    449
    Doug Nichols
    Feb 19, 2004
  2. Kenton Smeltzer

    UserControl Inheritence Design Time Editing

    Kenton Smeltzer, Jan 29, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    337
    Kenton Smeltzer
    Jan 29, 2004
  3. jqpdev
    Replies:
    2
    Views:
    310
    jqpdev
    Feb 15, 2004
  4. Eric Biggs

    vs designer and code-behind inheritence

    Eric Biggs, Apr 14, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    312
    Eric Biggs
    Apr 14, 2004
  5. Mark
    Replies:
    1
    Views:
    637
Loading...

Share This Page