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. custom validator

custom validator

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netdesignsysadmin
4 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.
  • G Offline
    G Offline
    gus_br
    wrote on last edited by
    #1

    how can i check if a user supplied date is before the current date? if this occur, i want to show a message about the error. i`ve tried with a custom validator and made the test within the server validate event handler of the control. but it didn`t work. the code is shown below: private void cvDtInAt_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args) { if(DateTime.Parse(txtDataInicio.Text) < DateTime.Now) args.IsValid = false; } also, i`m showing a error summary with the errors occured (as a textbox). i`m using VS2003 and ASP.NET 1.1 thanks in advance... (:

    E P 2 Replies Last reply
    0
    • G gus_br

      how can i check if a user supplied date is before the current date? if this occur, i want to show a message about the error. i`ve tried with a custom validator and made the test within the server validate event handler of the control. but it didn`t work. the code is shown below: private void cvDtInAt_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args) { if(DateTime.Parse(txtDataInicio.Text) < DateTime.Now) args.IsValid = false; } also, i`m showing a error summary with the errors occured (as a textbox). i`m using VS2003 and ASP.NET 1.1 thanks in advance... (:

      E Offline
      E Offline
      ednrgc
      wrote on last edited by
      #2

      I'm guessing that you are already validating that the text can be converted to a DateTime value. You also might want to DateTime.Today Is the validation firing?

      G 1 Reply Last reply
      0
      • E ednrgc

        I'm guessing that you are already validating that the text can be converted to a DateTime value. You also might want to DateTime.Today Is the validation firing?

        G Offline
        G Offline
        gus_br
        wrote on last edited by
        #3

        yes... it`s firing... i have already validating if the text can be converted to a DateTime, but using another validator, not this one. the question is... even if i set de argument`s IsValid property... it still doesn`t show the error in the error summary... have you got it now?

        1 Reply Last reply
        0
        • G gus_br

          how can i check if a user supplied date is before the current date? if this occur, i want to show a message about the error. i`ve tried with a custom validator and made the test within the server validate event handler of the control. but it didn`t work. the code is shown below: private void cvDtInAt_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args) { if(DateTime.Parse(txtDataInicio.Text) < DateTime.Now) args.IsValid = false; } also, i`m showing a error summary with the errors occured (as a textbox). i`m using VS2003 and ASP.NET 1.1 thanks in advance... (:

          P Offline
          P Offline
          P A N K A J
          wrote on last edited by
          #4

          are you validating the controls on server side or client side?

          Pankaj Gupta (Take it easy)

          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