RIA service Client side Validation using Metadata

2 posts, 0 answers
  1. Ubuntu
    Ubuntu avatar
    89 posts
    Member since:
    Jul 2012

    Posted 25 Jul 2011 Link to this post

    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 !!







  2. Shenbagaraj
    Shenbagaraj avatar
    9 posts
    Member since:
    Dec 2011

    Posted 28 Dec 2011 Link to this post

    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 ...
  3. DevCraft banner
Back to Top