问题描述
我不明白什么 AutoEventWireUp
页面属性负责。
I don't understand what the AutoEventWireUp
page property is responsible for.
在网上冲浪,我发现很多论坛的有关它的讨论,他们都似乎有差异给我。
While surfing the net, I have found a lot of forums with discussions about it and they all seem discrepant to me.
我可以请得到什么这个属性意味着完全是一个明确的解释?
Can I please get a clear explanation of what this property means exactly?
我已经通过,但即使这样,我不明白。
I've read through this article, but even that I don't understand.
推荐答案
在请求一个页面,它会引发这被认为是它的一部分各种事件的的。我一直href=\"http://www.eggheadcafe.com/articles/20051227.asp\">视觉重presentation 通过彼得布朗伯格创建得心应手
When a Page is requested, it raises various events which are considered to be part of it's lifecycle. I keep the visual representation created by Peter Bromberg handy with me.
的 AutoEventWireUp
属性为true时,自动连线了其中的一些内置在页面生命周期的处理程序事件。这意味着你不需要明确附上这些事件(使用Handles关键字,例如,在VB)。
The AutoEventWireUp
property when True, automatically wires up some of these built-in events in the Page life cycle to their handlers. This means that you do not need to explicitly attach these events (using the Handles keyword, for instance, in VB).
这些内置事件的例子是 Page_Init
和的Page_Load
。
Examples of these built-in events would be Page_Init
and Page_Load
.
如果您设置 AutoEventWireUp
为True 和提供明确的接线了事件处理器,你会发现他们正在执行两次!这就是为什么Visual Studio中保持这个属性被默认设置为假
。
If you set AutoEventWireUp
to True and provide explicit wiring up of the EventHandlers, you will find them being executed twice! This is one reason why Visual Studio keeps this attribute set to false
by default.
编辑:(Chester89的评论之后)
(after Chester89's comment)
要注意页面的 AutoEventWireUp
属性的默认值是真正
,而这是非常有用的Page类的 AutoEventWireUp
属性的默认值是假
It is useful to note that the default value of the AutoEventWireUp
attribute of the Page is true
, while the default value of the AutoEventWireUp
property of the Page class is false
这篇关于什么是AutoEventWireUp页面属性是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!