写好的页面中的按纽的委托事件无缘无故自动丢失,
比如:
private void InitializeComponent()
{   
this.Button1.Click += new System.EventHandler(this.Button1_Click); 
}
中的"this.Button1.Click += new System.EventHandler(this.Button1_Click); "会自动消失了,听说这是.net的一个bug,好象装个补丁就可以了.有谁知道修补此bug的补丁是什么?在哪下载?

解决方案 »

  1.   

    事件会丢的,而且很正常.尤其是你用了其他编辑器编辑了aspx页面之后,更是如此.
    这个没有办法,只能自己注意点.
      

  2.   

    我那个原因找到了,<form runat=server id=theForm></form>中不能再嵌套<form>了,不管是不是 runat=server,否则</form>后的服务器控件将不会激发
      

  3.   

    .net更新sp1之后按钮也会出现这个情况,解决方法
    原因是WebUIValidation.js造成的,找到函数function ValidatorCommonOnSubmit() {
        event.returnValue = !Page_BlockSubmit;
        Page_BlockSubmit = false;
     

     修改WebUIValidation.js如下即可解决问题function ValidatorCommonOnSubmit() {
        var result = !Page_BlockSubmit;
     event.returnValue = !Page_BlockSubmit;
        Page_BlockSubmit = false;
     event.returnValue = result;
     return result;
    }
      

  4.   

    private void InitializeComponent()
    {    
    InitWebControl();
    } private void InitWebControl()
    {
    //把自动生成的事件委托全都放在这里,就不会出现事件丢失的烦劳了
    this.Load += new System.EventHandler(this.Page_Load); }