
Global resources for validations (ASP .NET)
October 31, 2008If 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
- Create GlobalResources – Call them ValidationResources.resx
- Fill resources by expression and error message
- Add meta attribute with resource resource name into your @Page directive on the page where you want to use resource.
- Add RegularExpressionValidator from toolbox and set it to resource values.
- If you want you can skip last step and you can set it in the designer
- Now run the application and look whats happening