Click here to Skip to main content
16,021,823 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 6-Oct-10 23:29pm
v3
Comments
Rhuros 6-Oct-10 10:33am    
Providing the code that you're working with will enable people to help you.
TheyCallMeMrJames 6-Oct-10 10:36am    
How do you know they're not compared? Are you seeing an error? Are the values passed to the method? Are you persisting data?
Johnny J. 7-Oct-10 5:28am    
FYI: "So please solve my problem. I'm waiting for it." will be taken as a rude command by most of the members here. Next time you might want to formulate your question differently...

1 solution

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

XML
<%@ 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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <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>
 
Share this answer
 
v3
Comments
Baji Jabbar 7-Oct-10 5:26am    
Oh you answered to your own question ? :)
The question is not clear dear. Providing the code will also give a clear picture !
Johnny J. 7-Oct-10 5:32am    
FYI: "Please solve my problem." Same here: Rude formulation. A more correct way of expressing yourself would be: "Please help me solve my problem"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900