How Do i Compare Two Dates Inputs using asp.net validator ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hellboss
    New Member
    • Jun 2007
    • 50

    How Do i Compare Two Dates Inputs using asp.net validator ?

    Hi Every one !
    Im using asp .net vs05 , i My form im using two text boxes where the Date is entered in any format (dd/mm/yyy or dd/MMM/yyyy)
    Ex : From date ,To Date

    Now ! How do i Ensure that Todate is not Greater than the From Date, Is it Feasible with Asp.net Compare Validator ??

    Kindly Provide me with a valid Solution !!!

    Thanks in Advance !
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Well if you have it go back to backend code, you cna create DateTime objects from them and compare those objects.

    Comment

    • hellboss
      New Member
      • Jun 2007
      • 50

      #3
      Originally posted by Plater
      Well if you have it go back to backend code, you can create DateTime objects from them and compare those objects.
      The Problem is ! i cant alert the User by using the Msgbox, in the case if iam using the Objects and Comparing those two, but , I hope there should be an client side validation like ajax to do Accomplish this task !!

      It would be fine if iam Not using a msgbox for alerting the user . Any other solution ??
      :)

      Comment

      • vickytech
        New Member
        • Oct 2007
        • 2

        #4
        Originally posted by hellboss
        Hi Every one !
        Im using asp .net vs05 , i My form im using two text boxes where the Date is entered in any format (dd/mm/yyy or dd/MMM/yyyy)
        Ex : From date ,To Date

        Now ! How do i Ensure that Todate is not Greater than the From Date, Is it Feasible with Asp.net Compare Validator ??

        Kindly Provide me with a valid Solution !!!

        Thanks in Advance !
        Hi
        i m vikas here

        my Id is vickyTech
        There is very simple solution of this problem

        U just use compare validator.

        In that u have two property of validator

        Operator and Type

        in operator u set greaterthan (as u want) and in Type u set "Date"

        U have two more things to set

        "Control to compare" and "Control to validate"

        u select the nane of ur controls

        i will work
        bye

        Comment

        • hellboss
          New Member
          • Jun 2007
          • 50

          #5
          Originally posted by vickytech
          Hi
          i m vikas here

          my Id is vickyTech
          There is very simple solution of this problem

          U just use compare validator.

          In that u have two property of validator

          Operator and Type

          in operator u set greaterthan (as u want) and in Type u set "Date"

          U have two more things to set

          "Control to compare" and "Control to validate"

          u select the nane of ur controls

          i will work
          bye

          Hi ! Thanks for your Reply ,

          I Tried it but it didnt work for the Format dd-MMM-yyyy , It didnt Compare those two dates ? :(

          Any Solutions ?

          Comment

          Working...