Inheriting from base form

A

Andy Breward

Hi

I have created a base web form that all other pages
inherit from which is really nice as all my session and
seurity stuff goes in here and works well.

My issue is with the source code that the IDE creates,
this function: -

override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web
Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

Should the call to OnInit on the base form go before the
InitializeComponent() method? My reasoning is that
otherwise none of the base pages variables etc. have been
set during the Page_Load event of my real form until
afterwards!

I have simply been swapping these 2 lines around to gain
the desired result. So am I missing something in my
implementation or are my observations correct?

Thanks in advance

Andy
 
J

Jacob Yang [MSFT]

Hi Andy,

I am sorry if there is any misunderstanding.

As I understand, what you really want is "Building a Custom Web Form Wizard
in Visual Studio .NET". Please refer to the following article carefully.

Building a Custom Web Form Wizard in Visual Studio .NET
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechar
t/html/customwebwiz.asp
"...
In this document, we will see how we can create a wizard to help us add a
new Web Form page and its associated code-behind file. Since there is
already an existing project to do this, we will start our wizard's
implementation using that as the base. The wizard will appear in the Add
New Item dialog, which can be invoked by right-clicking on the solution and
selecting Add / Add New Item.
..."

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top