扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:廖煜嵘 编译 来源:天极网 2007年11月7日
关键字: Windows
<form id="Form1" method="post" runat="server"> <TABLE id="Table1" cellSpacing="0" cellPadding="0" width="504" align="center" borderColorLight="#996633" border="1"> <TR> <TD style="FONT-WEIGHT: bold" align="center" colSpan="3">Region Wise Reports</TD> </TR> <TR> <TD>Region Name</TD> <TD> <asp:TextBox id="txtRegionName" runat="server"></asp:TextBox></TD> <TD> <asp:RequiredFieldValidator id="rvRegion" runat="server" ControlToValidate="txtRegionName" ErrorMessage="Region is required"></asp:RequiredFieldValidator></TD> </TR> <TR> <TD></TD> <TD></TD> <TD> <asp:Button id="cmdRegion" runat="server" Text="Get Report"></asp:Button></TD> </TR> </TABLE> <br> <br> <TABLE id="Table2" cellSpacing="0" cellPadding="0" width="504" border="1" align="center" borderColorLight="#996633"> <TR> <TD style="FONT-WEIGHT: bold" align="center" colSpan="3">Date Wise Reports</TD> </TR> <TR> <TD>Start Date</TD> <TD> <asp:TextBox id="txtStartDate" runat="server"></asp:TextBox></TD> <TD> <asp:RequiredFieldValidator id="rvStartDate" runat="server" ControlToValidate="txtStartDate" ErrorMessage="Start Date is required"></asp:RequiredFieldValidator></TD> </TR> <TR> <TD>End Date</TD> <TD> <asp:TextBox id="txtEndDate" runat="server"></asp:TextBox></TD> <TD> <asp:RequiredFieldValidator id="rvEndDate" runat="server" ControlToValidate="txtEndDate" ErrorMessage="End Date is required"></asp:RequiredFieldValidator></TD> </TR> <TR> <TD style="WIDTH: 139px"></TD> <TD></TD> <TD> <asp:Button id="CmdDate" runat="server" Text="Get Report"></asp:Button></TD> </TR> </TABLE> </form> <script language="javascript"> function disableScript() { for(i=0;i< Page_Validators.length;i++) { //Page_Validators[i].isvalid=true; ValidatorEnable(Page_Validators[i], false) } } function enableRegionValidators() { for(i=0;i< Page_Validators.length;i++) { ValidatorEnable(Page_Validators[i], false) } ValidatorEnable(rvRegion, true) } function enableDateValidators() { for(i=0;i< Page_Validators.length;i++) { ValidatorEnable(Page_Validators[i], false) } ValidatorEnable(rvStartDate, true) ValidatorEnable(rvEndDate, true) } </script> <asp:Label id="lblReport" style="Z-INDEX: 101; LEFT: 144px; POSITION: absolute; TOP: 344px" runat="server" Width="344px" Height="24px"></asp:Label> DisableClientValidation.aspx:.cs主要代码: private void Page_Load(object sender, System.EventArgs e) { cmdRegion.Attributes.Add("onclick","enableRegionValidators();"); CmdDate.Attributes.Add("onclick","enableDateValidators();"); } private void cmdRegion_Click(object sender, System.EventArgs e) { rvStartDate.IsValid=true; rvEndDate.IsValid=true; lblReport.Text = "Region Wise Report For " + txtRegionName.Text.ToUpper(); } private void CmdDate_Click(object sender, System.EventArgs e) { rvRegion.IsValid=true; lblReport.Text = "Date Wise Report Betwee " + txtStartDate.Text.ToUpper() + " And " + txtEndDate.Text.ToUpper(); } } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者