现在我想通过取消按钮来控制Panel1和Panel2的显示和隐藏功能,但被验证控件限制了,没有有办法突破这个问题?谢谢
- HTML code
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Panel ID="Panel1" runat="server"> 11111111111 </asp:Panel> <asp:Panel ID="Panel2" Visible="false" runat="server"> <asp:TextBox MaxLength="50" ID="TextBox1" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="不能为空" ControlToValidate="Deptname" Display="Dynamic"></asp:RequiredFieldValidator> <asp:Button ID="Button1" runat="server" OnClick="CancelBtn_Click" Text="取消" /> </asp:Panel> </ContentTemplate></asp:UpdatePanel>
------解决方案--------------------------------------------------------
取消按钮的CausesValidation设为false看看
基本不用自带的验证控件
http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.button.causesvalidation.aspx