This is a migrated thread and some comments may be shown as answers.

RIA service Client side Validation using Metadata

1 Answer 77 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ubuntu
Top achievements
Rank 1
Ubuntu asked on 25 Jul 2011, 06:44 PM
Dear All,
I have created a project using EF4, RIA Service, few telerik controls.

I define my client-side validation using .shared files and add then using DataAnotation to the metadata class as follows:
public static class CustomDailyValidation
{
    public static ValidationResult ValidateSubsidiary(int id, ValidationContext validationContext)
    {
        if (id <= 0 || id == null)
        {
            return new ValidationResult("ERROR", new[] {validationContext.DisplayName});
        }
        return ValidationResult.Success;
    }
}

MetaData:
[CustomValidation(typeof(CustomDailyValidation), "ValidateSubsidiary")]
public int subsidiary_id { get; set; }

I then populate the subsidary_id with data using QDSCV (no Problem here)

I then add the xaml definition as follows:
<telerik:RadComboBox x:Name="discriptorId" Margin="0,0,0,5" Grid.Row="1" Grid.Column="3" IsEnabled="{Binding IsNew}"
    ItemsSource="{Binding Path=DiscriptorsCollection,Mode=TwoWay}"
    SelectedValue="{Binding Path=CurrentDaily.discriptor, Mode=TwoWay,NotifyOnValidationError=True,ValidatesOnExceptions=True}"
    SelectedValuePath="discriptor_id"
    DisplayMemberPath="discriptor_name_1"/>

The validation works as soon as I open the page, I don't know why, but anyway that is not the problem, the problem is that the subsidary_id combobox is displaying the error but with different message says "Input is not in correct format".

I don't know from where is that comes? how to stop / override?

Note:
I have another RadDatePicker that has different validation method,
when I set a break point in the client-side validation class the validation method for the date field is hit, but not the combo.

Any help !!







1 Answer, 1 is accepted

Sort by
0
Shenbagaraj
Top achievements
Rank 1
answered on 28 Dec 2011, 06:43 AM
Im also having the same issue if any one know the answer plz help me ..  

if i remove ValidatesOnExceptions=True then "Input is not in correct format" is not firing and validation is also not working

i have tried ValidatesOnDataErrors=True, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}

when i use silverlight combobox its working fine. but not in radcombobox....

help me ...
Tags
ComboBox
Asked by
Ubuntu
Top achievements
Rank 1
Answers by
Shenbagaraj
Top achievements
Rank 1
Share this question
or