Hello Steven,
Yes, the IDE is generating the PreInit in OnInit, more prcesely in the
InitializeComponent that is sent by preInit.
My projet is a Web Application, I am using Visual Studio Pro with SP1 on a
XP laptop, using C#, following are informations from VS.
For majority of my aspx pages AutoEventWireUp is turned off.
I followed this process: open the aspx page, choose Design mode, then from
right click menu choose View Component Designer (I have not found another
way to display the page properties with handlers), then right click again
and Properties, then Events button, then double click in the PreInit.
Switcing back to the code windows, I cans see the generated code:
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.PreInit += new System.EventHandler(this.DesktopDefault_PreInit);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DesktopDefault_PreInit(object sender, EventArgs e)
{
}
It seems a bug.
Here are My VS infos.
Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727
Installed Edition: Professional
Microsoft Visual Basic 2005 77626-009-0000007-41381
Microsoft Visual Basic 2005
Microsoft Visual C# 2005 77626-009-0000007-41381
Microsoft Visual C# 2005
Microsoft Visual Studio Tools for Office 77626-009-0000007-41381
Microsoft Visual Studio Tools for the Microsoft Office System
Microsoft Visual Web Developer 2005 77626-009-0000007-41381
Microsoft Visual Web Developer 2005
Microsoft Web Application Projects 2005 77626-009-0000007-41381
Microsoft Web Application Projects 2005
Version 8.0.50727.762
Crystal Reports AAC60-G0CSA4B-V7000AY
Crystal Reports for Visual Studio 2005
Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1
(KB926601)
This service pack is for Microsoft Visual Studio 2005 Professional Edition -
ENU.
If you later install a more recent service pack, this service pack will be
uninstalled automatically.
For more information, visit
http://support.microsoft.com/kb/926601
SQL Server Analysis Services
Microsoft SQL Server Analysis Services Designer
Version 9.00.2047.00
SQL Server Integration Services
Microsoft SQL Server Integration Services Designer
Version 9.00.1399.00
SQL Server Reporting Services
Microsoft SQL Server Reporting Services Designers
Version 9.00.1399.00
"Steven Cheng[MSFT]" <st*****@online.microsoft.coma écrit dans le message
de news: Gk****************@TK2MSFTNGHUB02.phx.gbl...
Hello CS,
Do you mean when you use Visual Studio to develop ASP.NET 2.0 web page,
the
IDE automatically add the "PreInit" handler's registering code in "OnInit"
function?
Generally, for ASP.NET 2.0 web pages, since the "AutoWireupEvent" is set
to
"true", we simply add the event handler function in codebehind(with the
expected naming convention) and the runtime will automatically attach the
handler to the page's corresponding event. e.g.
public partial class nav_menupage : System.Web.UI.Page
{
protected void Page_PreInit(object sender, EventArgs e)
{
Response.Write("<br/>Page_PreInit.....");
}
....................
}
Is this behavior not working in your development environment?
Please feel free to let me know your detailed scenario so that we can
perform some further research on this.
Look forward to your reply.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.