Posted on: 9/3/2012 3:29:30 AM | Views : 395

I have a button to inser records in database and a customeValidation function to check the fromDate and toDate's dateDifference must be less than 31 days. So I writted custCheckDates_ServerValidate event like this.
DateTime dt1 = new DateTime(year,month, day);
DateTime dt2 = new DateTime(year1, month1, day1);
TimeSpan diffRes = dt2.Subtract(dt1);
if (diffRes.Days > 31)
{
args.IsValid = false;
return;
}
else
args.IsValid = true;
It's working fine but when validation false it displays error msg but also insert records in the database.
So how I can stop the execution of inserting records in database if validation is false. I know that if I use ClientSideValidationFunction then writting 'return false' stop it but I want it server side.
...

Go to the complete details ...