DataForm Validation

2 posts, 0 answers
  1. Lucas
    Lucas avatar
    1 posts
    Member since:
    Oct 2012

    Posted 09 Jan 2013 Link to this post

    Hi

    I'm trying to get DataForm validation up and running for my WCF Service based application. I'm using item level attribute-based validation according to http://www.telerik.com/help/wpf/raddataform-validation-item-level.html. This is working fine if I add the attributes directly to the DTO classes generated by the Open Access Service Wizard (i.e. directly in Transport.cs).

    [DataMember]
    [Required]
    public virtual string Name {
        get {
            return this._name;
        }
        set {
            if (Name == value)
                return;
     
            this.OnPropertyChanging("Name");
            this._name = value;
            this.OnPropertyChanged("Name");
        }
    }


    However, as adding the metadata to Transport.cs is probably not the best idea, i tried to move the metadata to a seperate metadata class and inject it to the DTO via a MetaDataTypeAttribute.

    [MetadataTypeAttribute(typeof(EmployeeDto.Metadata))]
    public partial class EmployeeDto
    {
        internal sealed class Metadata
        {
            private Metadata() {
            }
     
            [Required]
            public string Name { get; set; }
        }
    }

    But i couldn't get this to work, the DataForm ignores the metadata while validating. Is there something I've missed or is this fature not supported by RadDataForm?

    Regards
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 14 Jan 2013 Link to this post

    Hello Lucas,

    May I ask you to send us a repro project that we would be able to debug on our side? You can do this via our support ticket system, which also grants 24h priority response.

    All the best,
    Ivan Ivanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top