按鈕上的CausesValidation設置為false

解决方案 »

  1.   

    确定按钮用<asp:button>,取消用<input type="button">。
      

  2.   

    btnAdd.CausesValidation = true
    btnCancel.CausesValidation = false
      

  3.   

    你可以查看取消按钮的属性,找到CausesValidation属性,把它设为false。
      

  4.   

    <input type="button" Text="取消"
           OnClick="javascript:location.href='default.aspx';">
    <asp:Button id="btnSubmit" Text="提交" runat="server" />