MetadataType support

5 posts, 0 answers
  1. Randy Hompesch
    Randy Hompesch avatar
    148 posts
    Member since:
    Nov 2008

    Posted 03 Dec 2016 Link to this post

     

    For the life of me I can't see what's wrong. I have a radgriview and I edit rowdetails with the raddataform. everything works great except the validation.
    I am using the code below metadatatype (as an example) to add validation attributes to a class generated by EF. Obviously, this class is what I have bound to the dataform. I've stripped it to the bare min for this discussion.

    The commented out code below shows a "buddy" class that I have implemented as a test to make sure the annotations are working. They are. If I have to create buddy classes and copy data for each returned record from a database query I will, but it seems rather a pain.

    Any insight would be greatly appreciated. I read somewhere that this metadata thing is not support by you. Is this true? If so, what is the recommended way of getting the job done?

    Thanks ... Ed

     

     

     

        [MetadataType(typeof(CALMS_SamplesMetaData))]
        public partial class CALMS_Samples: ValidatableBindableBase
        {
        }
        public class CALMS_SamplesMetaData : ValidatableBindableBase
        {
            private string _clientSampleID;
            [Required(ErrorMessage = "Required.")]
            [MaxLength(50, ErrorMessage = "Exceeded 50 characters")]
            public string ClientSampleID
            {
                get { return _clientSampleID; }
                set { SetProperty(ref _clientSampleID, value); }
            }
    }
     
        //public partial class CALMS_Samples : ValidatableBindableBase
        //{
        //    private string __test1;
        //    [Required(ErrorMessage = "Required.")]
        //    public string test1
        //    {
        //        get { return __test1; }
        //        set { SetProperty(ref _cli_test1entSampleID, value); }
        //    }
        //}
  2. Randy Hompesch
    Randy Hompesch avatar
    148 posts
    Member since:
    Nov 2008

    Posted 03 Dec 2016 in reply to Randy Hompesch Link to this post

    here's a link to the post about it not being supported.

    http://www.telerik.com/forums/metadatatype-support

  3. Stefan
    Admin
    Stefan avatar
    1073 posts

    Posted 07 Dec 2016 Link to this post

    Hello Randy,

    Thank you for your feedback.

    Indeed, validating through MetadataType attributes is currently not supported by RadDataForm. I am now raising the priority of the item, so I believe it will be included in our development plan.

    Best Regards,
    Stefan X1
    Telerik by Progress
    Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
  4. Randy Hompesch
    Randy Hompesch avatar
    148 posts
    Member since:
    Nov 2008

    Posted 07 Dec 2016 in reply to Stefan Link to this post

    Yeah it sure seems like this is something that should be supported.

    In the meantime, what is the recommended way to get the job done?

    Thanks ... Ed

     

  5. Stefan
    Admin
    Stefan avatar
    1073 posts

    Posted 08 Dec 2016 Link to this post

    Hello Ed,

    The logic of RadDataForm for validating through attributes relies solely on the built-in Validator provided by the framework. So, I am afraid, that I cannot provide an alternative solution or a workaround through the API of the control. For the time being, the recommended approach is to apply the validation attributes directly, as documented in the Item level attribute-based validation topic.

    Best Regards,
    Stefan X1
    Telerik by Progress
    Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Back to Top