Data annotations

All of our models are readonly. But we use data annotations to help describe each column. Is there a way to have the grid read the AutogenerateField displayattribute? This would help us in hiding the properties that are not for displaying on the ui. Also, is there any support for custom attributes?

3 Replies 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team December 24, 2020 10:11 AM UTC

Hi Rick, 

Greetings from Syncfusion support. 

We are not clear about your exact requirement. We suggest you to refer the below documentation for more details regarding using DataAnnotation in Grid and for the supported DataAnnotation attributes in Grid component.  

Query 1: This would help us in hiding the properties that are not for displaying on the ui. 
Based on this scenario, we suggest you to use our GridColumn Visible property. Please refer the below documentation for more details, 

Query 2 : Also, is there any support for custom attributes? 
We suggest you to refer to the below documentation for applying custom attributes for a Grid column. 

If we have misunderstood your query, or if you still need further assistance, kindly get back to us with the following details for better assistance. 
  1. Share a simple sample which you have tried from your side, showing your requirement and problem you are facing.
  2. Share with us a detailed explanation of the requirement or the problem you are facing.
  3. Share with us the complete Grid rendering codes and Grid model class codes.
  4. Share with us a video demo showing the problem you are facing.
  5. Share with us a detailed explanation of your complete requirement.

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 



TT tttrickyyy December 28, 2020 02:05 PM UTC

Thank you for your reply. Neither of your responses helps so let me give you a basic example of what we need. 
Response to Query1:
public class FooModel
    {
        [Display (Name ="FooBar", AutoGenerateField =true)]
        public string Bar { get; set; }
        [Display(AutoGenerateField = false)]
        public int AKey { get; set; }
    }

We use the EnableAutoFill on the SFGrid. We'd like the grid to NOT show the AKey (honoring the AutoGenerateField = false). Is there support for this?



RS Renjith Singh Rajendran Syncfusion Team December 29, 2020 10:43 AM UTC

Hi Rick, 

Thanks for your update. 

Currently, we don’t have support for this data annotation attribute in DataGrid. We have considered an usability feature improvement task Provide support for AutoGenerateField DataAnnotation attributefor this requirement. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision and technological feasibility. It will be implemented in our upcoming bi-weekly release which is expected to be rolled out by the end of January 2021   
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.    

We suggest you to refer the below documentation for more details regarding the supported list of data annotation attributes in Grid. 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer
Loader.
Up arrow icon