在UpdatePanel控件中使用验证控件
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-05-22
gs) TextBox1.Text = Calendar1.SelectedDate.ToShortDateString() Label1.Text = "" End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Label1.Text = "Tickets are available as of " & DateTime.Now.ToString() & "." End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) CompareValidator1.ValueToCompare = DateTime.Now.ToShortDateString() End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>UpdatePanel with Validators Example</title> </head> <body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <script type="text/javascript"> function ClearLastMessage(elem) { $get(elem).innerHTML = ''''; } </script> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> Select a date below or enter a date: <asp:TextBox ID="TextBox1" runat="server" Width="70px"></asp:TextBox><br /> <asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged" /> <br /> Specify number of tickets (1-10): <asp:TextBox ID="TextBox2" runat="server" Width="40px"></asp:TextBox><br /> <asp:Button ID="Button1" runat="server" OnClientClick="ClearLastMessage(''Label1'')" Text="Check Availability" OnClick="Button1_Click" /> <br /> <br /> <asp:Label ID="Label1" runat="server"></asp:Label> <br /> <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="Pick a date in the future." Operator="GreaterThanEqual" Type="Date" Display="None"> </asp:CompareValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="Date is required." Display="None"> </asp:RequiredFieldValidator> <asp: |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于在UpdatePanel控件中使用验证控件的所有评论