if i use combobox its working fine.. plz guys help me ASAP...
here is my code it highlights and fires when its combo box
<
ComboBox Name="comboboxMagazine" MinWidth="140" MaxWidth="300" Grid.Row="1" Grid.Column="3" Height="20" DisplayMemberPath="MagazineName" SelectedValuePath="MagazineID" ItemsSource="{Binding MagazineData, Mode=OneWay,Converter={StaticResource AddEmptyItemConverter}}" SelectedValue="{Binding JobRequest.MagazineID, Mode=TwoWay, ValidatesOnDataErrors=True, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}"/ >
when i changed to RADCOMBOBOX its not firing and not showing the validation in validation summary.
<telerik:RadComboBox Name="comboboxMagazine" MinWidth="140" MaxWidth="300" Grid.Row="1" Grid.Column="3" Height="20" DisplayMemberPath="MagazineName" SelectedValuePath="MagazineID" ItemsSource="{Binding MagazineData, Mode=OneWay,Converter={StaticResource AddEmptyItemConverter}}" SelectedValue="{Binding JobRequest.MagazineID, Mode=TwoWay, ValidatesOnDataErrors=True, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}" />
my business validation class called from context metadata as
[CustomValidation(typeof(BusinessValidation), "EmptyComboBoxValidation")]
public static ValidationResult EmptyComboBoxValidation(int id, ValidationContext validationContext) {
int stringDifference = -1;
switch (validationContext.MemberName) {
case "RequestCodeID":{
stringDifference = validationContext.MemberName.CompareTo( "RequestCodeID");
if (stringDifference == 0 && id == 0) {
return new ValidationResult("Select a Job Request.", new[] { validationContext.MemberName });
}
break; }}
my AddEmptyItemConverter class
public class AddEmptyItemConverter : IValueConverter
{
public object Convert(dynamic value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
if (value.GetType().IsGenericType)
if (value.Count > 0)
value.Insert(0,
Activator.CreateInstance(value[0].GetType()));
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
help me ASAP............