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

MetadataType support

4 Answers 98 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Randy Hompesch
Top achievements
Rank 1
Randy Hompesch asked on 03 Dec 2016, 12:16 PM

 

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); }
    //    }
    //}

4 Answers, 1 is accepted

Sort by
0
Randy Hompesch
Top achievements
Rank 1
answered on 03 Dec 2016, 12:18 PM

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

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

1
Stefan
Telerik team
answered on 07 Dec 2016, 09:22 AM
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.
1
Randy Hompesch
Top achievements
Rank 1
answered on 07 Dec 2016, 10:27 AM

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

 

0
Stefan
Telerik team
answered on 08 Dec 2016, 02:31 PM
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.
Tags
DataForm
Asked by
Randy Hompesch
Top achievements
Rank 1
Answers by
Randy Hompesch
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or