i am using the compare validator for this. and i am using the property as OPERATOR.
I want the gap of two years,three years for gradution and hsc.
please help me as soon as possible.
Thanks in advance.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Raj BandiRank #1,603 · 981 reputationPosted May 5, 2013, 12:23 AM EDT
Why not you use a custom validator. This way you can implement your own custom logic.
OnServerValidate="YearsGap_ServerValidate"
ErrorMessage="Your error message">
Server side method
protected void YearsGap_ServerValidate(object source, ServerValidateEventArgs args) { //your custom logic check here //compare dropdown values here
if( //somecondition ) // validation successful { args.IsValid = false; } else // if validation unsuccessful { ((CustomValidator)source) .ErrorMessage = @"Some error message"; args.IsValid = false; } }
if you want to use both server and client validation functions, add ClientValidationFunction attribute to your CustomValidator
ClientValidationFunction="YearsGap_ClientValidate"
ErrorMessage="Some error message.">
function YearsGap_ClientValidate(source, args)
{
//set args.IsValid to true or false depending your custom validation logic
}
Hope this helps,
Cheers,
Raj