Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Inherit Page_Load method

Reply
Thread Tools

Inherit Page_Load method

 
 
=?Utf-8?B?Q2hyaXN0b3BoZXIgQXR0YXJk?=
Guest
Posts: n/a
 
      02-03-2004
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

 
Reply With Quote
 
 
 
 
Hans Kesting
Guest
Posts: n/a
 
      02-03-2004

"Christopher Attard" <christopher(REMOVE_THIS)@gfi.com> wrote in message
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q2hyaXN0b3BoZXIgQXR0YXJk?=
Guest
Posts: n/a
 
      02-03-2004
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dictionary inherit and method overriding fdb Python 0 07-15-2009 10:49 AM
Materpage page_load event fired after content page_load? rockdale ASP .Net 1 11-16-2006 06:59 PM
in VB.NET Page_load of a base class called after the derived class Page_load ? z. f. ASP .Net 0 10-19-2004 12:01 PM
inherit and overwrite a property (better its method call) chris Python 2 03-01-2004 01:55 AM
Why does page_load fire twice when inheriting from a common overridable Page_Load bminder ASP .Net 1 02-23-2004 08:54 PM



Advertisments