I have many asp.net validation controls in my aspx page and I dont want to hard code there error message.
I want to put a variable in C#, set error message there and set text properties of required filed validates. Unfortunately I dont know how to do it.
Please guide me is it possible and how it is possible ?
An ASP.Net Validation Control typically derives from BaseValidator, which has both a Text property as well as a ErrorMessage property.
You can set either of these in your code behind. So given this validator:
In your code behind you can do this:
The Text property is what shows up directly in the control, and the ErrorMessage is what get’s shown in the ValidationSummary