比较两个TextBox日期值 [英] Comparing two TextBox date values
本文介绍了比较两个TextBox日期值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想比较两个TextBox值,即FromDate和ToDate.
ToDate必须大于FromDate.那是必要条件.我正在使用Ajax日历提供日期.
但是我的问题是,当我为此创建一个Websetup时,存在的问题是无法比较值.但是,当我们运行应用程序而不创建websetup时,它运行良好.
所以请解决我的问题.我在等它.
在此先感谢您
I want to compare two TextBox values i.e. FromDate and ToDate.
ToDate must be greater than FromDate. That''s a necessary condition. I''m providing the date from an Ajax calender.
But my problem is that when I create a websetup for this, there''s the problem that values are not compared. But when we run the application without creating a websetup it works fine.
So please solve my problem. I''m waiting for it.
Thanks in advance
推荐答案
在创建Web设置期间遇到错误.错误是当我在第二个文本框中更改值时,弹出比较验证器.
请解决我的问题.
这是我的html代码,如下所示
I face an error during the creation of the web setup. The error is that when I change values in the second textbox then compare validator is popping up.
Please solve my problem.
here is my html code which is shown below
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</cc1:ToolkitScriptManager>
<asp:Label ID="Label1" runat="server" Text="From Date"></asp:Label>
<asp:TextBox ID="TxtBoxFromDate" runat="server"></asp:TextBox>
<cc1:CalendarExtender ID="TxtBoxFromDate_CalendarExtender" runat="server"
Enabled="True" TargetControlID="TxtBoxFromDate" Format="dd/MM/yyyy"
TodaysDateFormat="dd/MM/yyyy">
</cc1:CalendarExtender>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="To Date"></asp:Label>
<asp:TextBox ID="TxtBoxToDate" runat="server"></asp:TextBox>
<cc1:CalendarExtender ID="TxtBoxToDate_CalendarExtender" runat="server"
Enabled="True" TargetControlID="TxtBoxToDate" Format="dd/MM/yyyy"
TodaysDateFormat="dd/MM/yyyy">
</cc1:CalendarExtender>
<br />
<br />
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="TxtBoxToDate" ControlToValidate="TxtBoxFromDate"
ErrorMessage="CompareValidator" Operator="LessThanEqual" Type="Date"
ValueToCompare="dd/MM/yyyy">To Date must be greater than From Date</asp:CompareValidator>
</form>
</body>
</html>
这篇关于比较两个TextBox日期值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文