Inherit Page_Load method

Discussion in 'ASP .Net' started by =?Utf-8?B?Q2hyaXN0b3BoZXIgQXR0YXJk?=, Feb 3, 2004.

  1. Hi,
    I have some repeated code in the Page_Load() methods in several asp.net pages. This common code performs some checking and is not related to HTML.

    I tried to create a Base asp.net page containing this common code in the Page_Load() and the other asp.net pages inherit this base page and ovverride this method. The problem is that only the code in the base page is being excecuted.

    Any ideas?

    Chris
     
    =?Utf-8?B?Q2hyaXN0b3BoZXIgQXR0YXJk?=, Feb 3, 2004
    #1
    1. Advertising

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

    Hans Kesting Guest

    "Christopher Attard" <christopher(REMOVE_THIS)@gfi.com> wrote in message
    news:...
    > Hi,
    > I have some repeated code in the Page_Load() methods in several

    asp.net pages. This common code performs some checking and is not related to
    HTML.
    >
    > I tried to create a Base asp.net page containing this common code in the

    Page_Load() and the other asp.net pages inherit this base page and ovverride
    this method. The problem is that only the code in the base page is being
    excecuted.
    >
    > Any ideas?
    >
    > Chris
    >


    How did you override the method from the base class?
    How did you attach the method to the Load event?


    It should be something like:

    protected override void Page_Load(...)
    {
    base.Page_Load(...);
    ....
    }

    where this Page_Load is attached to the Load event of this page.


    Hans Kesting
     
    Hans Kesting, Feb 3, 2004
    #2
    1. Advertising

  3. yeah ok 10x. Infact it's actually running the base page and the page's Page_Load() method.

    Now the problem is that it's not handling the other events. For eg: In asp.net page1 (which inherits the base page) I have 2 buttons. Their event handlers are imnplemented and also registered in page1 but they are not working

    Each of these pages contains different events so I can neither put them in the base class. What else can be done

    Chri
     
    =?Utf-8?B?Q2hyaXN0b3BoZXIgQXR0YXJk?=, Feb 3, 2004
    #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. bminder
    Replies:
    1
    Views:
    2,177
    nfedin
    Feb 23, 2004
  2. z. f.
    Replies:
    0
    Views:
    563
    z. f.
    Oct 19, 2004
  3. chris
    Replies:
    2
    Views:
    324
    Nicodemus
    Mar 1, 2004
  4. rockdale
    Replies:
    1
    Views:
    661
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
  5. fdb
    Replies:
    0
    Views:
    354
Loading...

Share This Page