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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Raj BandiPosted May 5, 2013, 4:23 AM
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