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. General Programming
  3. C#
  4. Custom validator error: PropertiesValid throws object reference

Custom validator error: PropertiesValid throws object reference

Scheduled Pinned Locked Moved C#
helpdesignquestion
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.
  • L Offline
    L Offline
    livez
    wrote on last edited by
    #1

    Hello! I´ve made a customError-class inheriting from BaseValidator which I use to add error to Page.Validators from code-behind. public class CustomError : BaseValidator At first I inherited from IValidator , but I had to be able to set ValidationGroup and so I switched to BaseValidator. Problem is now the PropertiesValid-property of my class always throws an object reference-error. I´m giving ControlToValidate a correct value, so thats not whats causing this. Does anyone have an idea why this error occurs and how I prevent it? The error looks like this:

    [NullReferenceException: Objectreference has not been set to an instance of an object.]

    [NullReferenceException: Objectreference has not been set to an instance of an object.]
    System.Web.UI.WebControls.BaseValidator.CheckControlValidationProperty(String name, String propertyName) +23
    System.Web.UI.WebControls.BaseValidator.ControlPropertiesValid() +37
    System.Web.UI.WebControls.BaseValidator.Validate() +58

    L 1 Reply Last reply
    0
    • L livez

      Hello! I´ve made a customError-class inheriting from BaseValidator which I use to add error to Page.Validators from code-behind. public class CustomError : BaseValidator At first I inherited from IValidator , but I had to be able to set ValidationGroup and so I switched to BaseValidator. Problem is now the PropertiesValid-property of my class always throws an object reference-error. I´m giving ControlToValidate a correct value, so thats not whats causing this. Does anyone have an idea why this error occurs and how I prevent it? The error looks like this:

      [NullReferenceException: Objectreference has not been set to an instance of an object.]

      [NullReferenceException: Objectreference has not been set to an instance of an object.]
      System.Web.UI.WebControls.BaseValidator.CheckControlValidationProperty(String name, String propertyName) +23
      System.Web.UI.WebControls.BaseValidator.ControlPropertiesValid() +37
      System.Web.UI.WebControls.BaseValidator.Validate() +58

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      Try the ASP.NET forum.

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 4a out now (29 May 2008)

      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