开发者

Where is the Component Initialize Method in Asp.NET 3.5

开发者 https://www.devze.com 2022-12-16 03:24 出处:网络
I want to create my own naming convention for page events rather than AutoEventWireUp but I couldn\'t find Component Initialize methods any where ? Should I override it ? But in which class it is defi

I want to create my own naming convention for page events rather than AutoEventWireUp but I couldn't find Component Initialize methods any where ? Should I override it ? But in which class it is defined ?

Thanks...

Edit :

For example : I don't want to use Page_Load but LoadThisPage naming. So It should be like

Load += new LoadThisPage(sender,e);

I was expecting a InitializeComponent method where I can initialize page,contro开发者_开发知识库ls etc. events handlers...But it turned out to be Constructor function :)

So what confused me is I thought there should have been a method like InitializeComponent which does things for me already created by Designer itself so I thought I could define my own event handler names within this method by overriding it in the say Default.aspx.cs .

But the answer was simple :) Thanks...


Your question isn't really clear as to what you're trying to do.

Page events are defined in the System.Web.UI.Page class, some of which are inherited from System.Web.UI.Control. You don't need to use AutoEventWireUp if you don't want to, and you're free to override all of the Page methods that would normally raise the lifecycle events (OnInit, OnLoad, OnPreRender, etc.) and then not call the base methods, effectively squelching the events from being raised.

You can see some limited discussion around this on this blog post.

As Hogan noted, this sounds like a bad idea. Could you expand on what you're trying to accomplish?


This sounds like a bad idea to me.

However, you should be able to find auto-created code by selecting the project display options, I believe it is right click in project explorer, and selecting display hidden files or display all files. Then you will see additional .vb files created by the system. You might also have click on the little plus sign.

additonal added notes

Most of the events (btw) are defined in the base class(es) in System.Web.UI.Page and not in the code created for a specific instance.

0

精彩评论

暂无评论...
验证码 换一张
取 消