I have to validate that the year entered must be less than or equals to the current year. I am using server side validators in ASP.Net and C#, and all validators are inside a validator group. So please suggest me to validate one more condition within the same.
Thanks
Amit Ranjan.
Use the ASP.NET CompareValidator.
For e.g. if you have a TextBox with id TextBox1, which accepts a year in ‘yyyy’ format, then you can do the following:
Add this to code behind:
Also remember using validators won’t stop a Submit; use these in conjunction with ValidationSummary Control.
More on MSDN: http://msdn.microsoft.com/en-us/library/f9h59855(v=vs.80).aspx