Asp.Net 2.0 Web Application Project Inherited Base class?

Discussion in 'ASP .Net' started by gabe, Mar 21, 2007.

  1. gabe

    gabe Guest

    Hi,

    Is it possible using Web Application Projects with Asp.Net 2.0 Sp1 to
    have a partial class code behind inherit from a base class that could
    be used for all the pages on a web site?

    The site uses a Master page, but there are some tasks I'd prefer to be
    done elsewhere. For example there a couple of common controls in the
    Master Page that may be used differently by some of the pages. And I'd
    like to have common code that can call a service layer for things like
    logging user actions to a db without have to repeat it in every page.

    Thanks in advance,

    Gabe
     
    gabe, Mar 21, 2007
    #1
    1. Advertisements

  2. gabe

    Mark Rae Guest

    "gabe" <> wrote in message
    news:...

    > Is it possible using Web Application Projects with Asp.Net 2.0 Sp1 to
    > have a partial class code behind inherit from a base class that could
    > be used for all the pages on a web site?


    Yes absolutely! I do this all the time.

    Just create your base class and then change the partial class declaration to
    ineherit from it instead of System.Web.UI.Page
     
    Mark Rae, Mar 21, 2007
    #2
    1. Advertisements

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. Alicia
    Replies:
    3
    Views:
    1,201
    jjr2004a
    Nov 24, 2004
  2. Ethan V
    Replies:
    2
    Views:
    5,231
    Ethan V
    Jun 25, 2006
  3. =?Utf-8?B?anJldHQ=?=
    Replies:
    1
    Views:
    1,075
    Laurent Bugnion
    Sep 26, 2006
  4. Josh Mcfarlane
    Replies:
    2
    Views:
    429
    Josh Mcfarlane
    Aug 18, 2005
  5. Alf P. Steinbach
    Replies:
    6
    Views:
    808
    John Carson
    Sep 3, 2005
  6. Hicham Mouline
    Replies:
    1
    Views:
    822
    Victor Bazarov
    Apr 20, 2009
  7. 7stud --
    Replies:
    11
    Views:
    770
    7stud --
    Nov 9, 2007
  8. Karan Rajput
    Replies:
    2
    Views:
    301
    Abinoam Jr.
    Dec 22, 2010
Loading...