h1

Global resources for validations (ASP .NET)

October 31, 2008

If you want to reuse expressions, error messages etc. for validators, you should use app.config storage or resources.

I will show you how to use resources for storing adjustments of ExpressionValidator .

  • Create Global resource directory

    1

  • Create GlobalResources – Call them ValidationResources.resx
    2 
  • Fill resources by expression and error message

    3

  • Add meta attribute  with resource resource name into your @Page directive on the page where you want to use resource.

    4

  • Add RegularExpressionValidator from toolbox and set it to resource values.

    5

  • If you want you can skip last step and you can set it in the designer

    6

  • Now run the application and look whats happening ;)

     7

Leave a Comment