how to make grid honour viewmodel data annotations

Not Answered This post has 0 verified answers | 1 Reply | 1 Follower Thread's RSS feed.

Points 840
Replied On: Wed, Mar 1 2017 6:13 AM Reply

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 ?

  • Post Points: 20

All Replies

[Infragistics] Maya
Points 28,827
Infragistics Employee
Replied On: Thu, Mar 2 2017 3:28 AM Reply

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 <>. 

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.



  • Post Points: 5
Page 1 of 1 (2 items) | RSS