Results 1 to 1 of 1

Thread: CopareValidation for Dates

  1. #1

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446

    CopareValidation for Dates

    hi
    I have 2 Date Texboxes and To-Date must be greater than from-date.
    And Also dateDifference of From and ToDate must be Equat to Number ofDays.

    I am very confusing to giving the validation for DateDifference of from and to date = NoDays.

    Can anyone Help me this.
    This is my code
    Code:
     
    <asp:TextBox id="txtNoDays"  runat="server" size="12"></asp:TextBox>
    
    <Asp:Textbox id="txtFromDate" runat="server" size="12"></Asp:Textbox>
    <asp:CompareValidator id="StartVal" runat="server" ErrorMessage="?" ControlToValidate="txtFromDate" Operator="DataTypeCheck" Type="Date"></asp:CompareValidator>
    
    <asp:TextBox id="txtToDate" runat="server" size="12"></asp:TextBox>
    <asp:CompareValidator id="DiffVal" runat="server" ErrorMessage="?" ControlToValidate="txtToDate" Operator="GreaterThan" Type="Date" ControlToCompare="txtFromDate"></asp:CompareValidator>
    Suppose txtNoDays=2 and DateDiff("d",txtFromDate,txtToDate)=3 then the error message shold display.

    thanks
    Last edited by buddu; Oct 7th, 2002 at 02:21 AM.
    prasad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width