Page_Init calling sequence in ASP.NET
i need to create custom base class for my ASP.NET 2.0 web pages.
A : InheritsWeb.UI.Page
B : Inherits A
C : Inherits B
and then all my web pages extends/Inherits custom base class 'C'.
now i need to write page_Init in class 'B' and 'C' .
Please help me how to write page_Init method in the above Scenario.
If you people have any reference code, where custom base class is used in ASP.NET 2.0. let me know
From http://developmentnow.com/g/8_2006_11_0_7_0/dotnet-framework-aspnet.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Date:Mon, 06 Aug 2007 20:05:36 GMT
Author:
|
RE: Page_Init calling sequence in ASP.NET
place all three (A, B & C) in your App_Code folder and modify your web.config
as follows:
<system.web>
...
<pages pageBaseType="PageC">
...
this way all your pages will be forced to inherit from C
I did not understand the question/problem about writing Page_Init. If you
need to control the order of code execution, use OnInit override, otherwise
just place Page_Init into your classes (assuming that AutoEventWireup is set
to true) or hook it up in the classes' constructor.
"Nirmalkumar" wrote:
> i need to create custom base class for my ASP.NET 2.0 web pages.
>
> A : InheritsWeb.UI.Page
>
> B : Inherits A
>
> C : Inherits B
>
> and then all my web pages extends/Inherits custom base class 'C'.
>
> now i need to write page_Init in class 'B' and 'C' .
>
> Please help me how to write page_Init method in the above Scenario.
>
> If you people have any reference code, where custom base class is used in ASP.NET 2.0. let me know
>
> From http://developmentnow.com/g/8_2006_11_0_7_0/dotnet-framework-aspnet.htm
>
> Posted via DevelopmentNow.com Groups
> http://www.developmentnow.com
>
Date:Mon, 6 Aug 2007 15:16:01 -0700
Author:
|