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

DataAnnotations / DisplayFormat

5 Answers 125 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Troy Roberson
Top achievements
Rank 1
Troy Roberson asked on 28 Jun 2010, 05:29 PM
We're using the DataAnnotations in several of our classes that populate the Gridview, and DisplayAttribute works fine, but trying to use [DisplayFormat(DataFormatString = "{0:d}")] for a datetime doesn't seem to work.  The time always gets carried over into the Grid.

Is this currently supported in the GridView?  Or am I doing something wrong?

Troy

5 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 28 Jun 2010, 05:51 PM
Hello Troy Roberson,

The DisplayFormatAttribute is not yet supported by RadGridView but we will try to include it in a future release. At the moment you can use the DataFormatString property of our GridViewDataColumn to format the data that is displayed.

Thank you for your feedback. Your Telerik points have been updated.


All the best,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tomas
Top achievements
Rank 1
answered on 29 Jun 2010, 11:24 AM

Do you have a more precise schedule for when you plan to implement this (and other DataAnnotation support as well)?
We are also using DataAnnotations on our classes and this is a very important feature for us.

To insert DataFormatString on every RadGridView where you use a DateTime field doesn't feel like a very feasible solution when you could have it specified in just one place and have the controls automatically pick this up.

Another DataAnnotation we've got problems with is [Editable(false, AllowInitialValue=true)] which in the RadGridView has the behaviour that it allows still allows you to edit the field but when you're done editing you get a validation error telling you the field is readonly. Here again if I want the column to be readonly I'll have to specify it in xaml.

Tomas

0
Milan
Telerik team
answered on 29 Jun 2010, 12:35 PM
Hello Tomas,

We won't be able to include support for those attributes in our next release (Q2) but we will do our best to improve our handling of such attributes with the service pack releases after Q2.


Kind regards,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Sebastian Talamoni
Top achievements
Rank 1
answered on 08 Sep 2010, 04:13 PM
Milan,

I was also relying on this attribute...

It´s a pitty that it´s not yet supported in Q2 SP1.
Are there any news about this feature?

For some simple ViewModels we use the same View + Grid with ItemSource={Bindinding Items} and using autoGenerateColumns=true, so i don't think I can use that workaround mentioned inside this thread.. 

Thanks in advance,
Sebastian Talamoni
0
Nedyalko Nikolov
Telerik team
answered on 13 Sep 2010, 03:09 PM
Hi Sebastian Talamoni,

You can download our latest internal build in order to get support for DisplayFormatAttribute and ReadOnlyAttribute. In a week or two we will release SP2 which will make support for these attributes official.
Let me know how it works on your end.

Sincerely yours,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Troy Roberson
Top achievements
Rank 1
Answers by
Milan
Telerik team
Tomas
Top achievements
Rank 1
Sebastian Talamoni
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Share this question
or