PC Review


Reply
Thread Tools Rate Thread

Change event sequence

 
 
Redhairs
Guest
Posts: n/a
 
      10th Jan 2008
I created two base page class and a webform to inherit them as blow.

Public Class BasePage:System.Web.UI.Page
{
protected override void OnPreInit(EventArgs e)
{ base.OnPreInit(e); }
}


Public Class ContentPage : BasePage
{
protected override void OnPreInit(EventArgs e)
{ base.OnPreInit(e); }
}

WebForm.aspx inherit theContentPage class

Then the event execution order is the Page_PreInit() ->
BasePage.OnPreInit() -> ContentPage.OnPreInit()
How to change the execution sequence as below?
(1) ContentPage.OnPreInit()
(2) BasePage.OnPreInit()
(3) Page_PreInit()


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      10th Jan 2008
its all an when you call the base routine try:

Public Class BasePage:System.Web.UI.Page
{
protected override void OnPreInit(EventArgs e)
{
// do base page stuff

base.OnPreInit(e); // fires Page_PreInit()
}
}


Public Class ContentPage : BasePage
{
protected override void OnPreInit(EventArgs e)
{
// do content stuff here

base.OnPreInit(e); // fire basepage
}
}

-- bruce (sqlwork.com)


"Redhairs" wrote:

> I created two base page class and a webform to inherit them as blow.
>
> Public Class BasePage:System.Web.UI.Page
> {
> protected override void OnPreInit(EventArgs e)
> { base.OnPreInit(e); }
> }
>
>
> Public Class ContentPage : BasePage
> {
> protected override void OnPreInit(EventArgs e)
> { base.OnPreInit(e); }
> }
>
> WebForm.aspx inherit theContentPage class
>
> Then the event execution order is the Page_PreInit() ->
> BasePage.OnPreInit() -> ContentPage.OnPreInit()
> How to change the execution sequence as below?
> (1) ContentPage.OnPreInit()
> (2) BasePage.OnPreInit()
> (3) Page_PreInit()
>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Event sequence =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= Microsoft ASP .NET 7 10th Nov 2006 08:39 AM
event sequence =?Utf-8?B?RGFiYmxlcg==?= Microsoft ASP .NET 1 17th Jul 2006 04:50 PM
event Sequence =?Utf-8?B?U3R1?= Microsoft Dot NET 0 14th Apr 2005 09:27 PM
Event sequence for a form Frank Reichenbacher Microsoft VB .NET 0 30th Sep 2004 04:40 PM
How To Trap Cell Value Change Event so determine XL calc sequence? Alex Lai Microsoft Excel Programming 4 30th Jun 2004 12:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:24 PM.