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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. date format validation through regular expression validators C#

date format validation through regular expression validators C#

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netregex
2 Posts 2 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.
  • A Offline
    A Offline
    ashu_sharma21
    wrote on last edited by
    #1

    Hi, Is it possible to do date format validation through regular expression validatoir in asp.net (c#). and if it is possible then please suggest wut regular expression is used for it. Regards Ashu Sharma

    M 1 Reply Last reply
    0
    • A ashu_sharma21

      Hi, Is it possible to do date format validation through regular expression validatoir in asp.net (c#). and if it is possible then please suggest wut regular expression is used for it. Regards Ashu Sharma

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

      Hi there, Depending on the format of a date value which you want to validate, you can choose an appropriate regular expression for the ValidationExpression property of the RegularExpressionValidator. You can see some patterns from here Regular Patterns[^] or Google can give you a bunch. In addition to RegularExpressionValidator, you can simply use a CompareValidator[^] to do that, set the Type property to Date and the Operator to DataTypeCheck. However, you also should remember that this validator is Culture sensitive, the regular expression used by the CompareValidator depends on the current CultureInfo value. You can also use a CustomValidator[^]with which you can provide your own logical business to validate a date value.

      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