how to make grid honour viewmodel data annotations

Im using a view model as the data source for a grid and i have some date properties

        [DisplayName("Start Date")]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
        public DateTime  StartDate { get; set; }

        [DisplayName("End Date")]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
        public DateTime EndDate { get; set; }

when I display these in the grid they default to US format date.  I dont want to have to repeat the format in the grid definition (it kinda defeats the object of data annotations on the model) so how can i make the grid honour the data format in my model ?

No Data
  • 28977
    Offline posted

    Hello Mark ,

     Thank you for posting in our forum.

    Currently the igGrid does not take into account the DisplayFormat annotation when generating its client-side code.

    You can log adding this functionality as a new product idea at <http://ideas.infragistics.com>. 

    In the meantime you can specify the Format option of the related columns to change the displayed format. 

    Let me know if you have any questions. 

    Best Regards,

    Maya Kirova

    Product Developer

    Infragistics, Inc.




No Data