private void validationProvider1_ValueConvert(object sender, Microsoft.Practices.EnterpriseLibrary.Validation.Integration.ValueConvertEventArgs e) { if (e.SourcePropertyName == "NoOfCourses") { string originalValue = e.ValueToConvert as string; int convertedValue; bool success = Int32.TryParse(originalValue, out convertedValue); if (success) { e.ConvertedValue = convertedValue; } else { e.ConversionErrorMessage = "No. Of Courses Points must be a valid integer"; } } }
private void customerValidationProvider_ValueConvert(object sender, Microsoft.Practices.EnterpriseLibrary.Validation.Integration.ValueConvertEventArgs e) { // Get the value of the RewardPoints control and convert to an integer if (e.SourcePropertyName == "RewardPoints") { string originalValue = e.ValueToConvert as string; int convertedValue; bool success = Int32.TryParse(originalValue, out convertedValue); if (success) { e.ConvertedValue = convertedValue; } else { e.ConversionErrorMessage = "Reward Points must be a valid integer"; } } }