Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. DateTime Validation

DateTime Validation

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MihirV
    wrote on last edited by
    #1

    hi all, i have a TextBox control for DateTime input on the Page. i have multiple check on this DateTime control. Like... -Not Null -Valid DateTime -must be greater than some another DateTime -Others also in ASP.Net we have different Validation control to solve it. but i am using CustomValidater to check in one go. i am not understanding how to check DateTime whether it is a valid string or not. if anybody has idea please tell me... Except **try-catch(FormatException)** thanks in advance Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..

    M A 2 Replies Last reply
    0
    • M MihirV

      hi all, i have a TextBox control for DateTime input on the Page. i have multiple check on this DateTime control. Like... -Not Null -Valid DateTime -must be greater than some another DateTime -Others also in ASP.Net we have different Validation control to solve it. but i am using CustomValidater to check in one go. i am not understanding how to check DateTime whether it is a valid string or not. if anybody has idea please tell me... Except **try-catch(FormatException)** thanks in advance Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      I'm curious about why you don't choose the simple way of catching the FormatException. Anyway, there two methods that might give you a hint: + Use Reflector to have a look at the internal static DateTimeParse.Parse method. + Take a look at the client side function ValidatorCompare in the WebUIValidation.js.

      1 Reply Last reply
      0
      • M MihirV

        hi all, i have a TextBox control for DateTime input on the Page. i have multiple check on this DateTime control. Like... -Not Null -Valid DateTime -must be greater than some another DateTime -Others also in ASP.Net we have different Validation control to solve it. but i am using CustomValidater to check in one go. i am not understanding how to check DateTime whether it is a valid string or not. if anybody has idea please tell me... Except **try-catch(FormatException)** thanks in advance Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Hi Mihir, Unfortunately, there is not direct way in ASP.net to validate the data except the try...catch block. Banshi Khinchi

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups