快速业务通道

在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 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号