我有AutoEventWireup =“true”并在我的代码后面
protected void Page_Init(object sender,EventArgs e) { }
当我调试时,Page_Init方法被激活了两次!
这是怎么回事?
解决方法
让我们确保我们在这里介绍基础知识:
您的页面上是否有任何具有服务器事件的控件?如果是这样,请记住每次回发都会重新创建整个页面.因此,处理事件意味着运行所需的所有代码将页面放在一起,包括Init和Load事件.
Always two there are,no more no less. A request and a response.