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

Set default format for all Dates in a grid

3 Answers 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Noah
Top achievements
Rank 1
Noah asked on 08 Apr 2020, 11:32 AM

Hi, we are able to set the format for a date column using column binding such as follows: 

c.Bound(col => col.Created).Title("Date").Format("{0: yyyy-MM-dd HH:mm:ss UTC}");

 

 

Is there a way to dictate formatting at the grid level so that all grid columns receive the format and we don't have to repeat the format string for each column? This would be especially useful for us because we extract our default grid settings to an extension method, so we would be able to dictate the default format for all columns for all grids in one place.

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 09 Apr 2020, 08:31 PM

Hello Noah,

The Grid can have columns bound to fields of different types: boolean, date, string, etc., for that reason there is no configuration option dedicated to setting the format of all columns, because that format won't be applicable to all data types. Column format is applied per column only.

Regards,
Ivan Danchev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Noah
Top achievements
Rank 1
answered on 09 Apr 2020, 08:40 PM

Okay, we will make due. For the record, I was hoping for type-specific options like the ones found on the Fitlerable options. For example:

.Filterable(filterable =>
    {
        filterable.Extra(false);
        filterable.Operators(o =>
        {
            o.ForString(str => str.Clear().Contains("Contains").IsEqualTo("Is equal to"));
            o.ForEnums(en => en.Clear().IsEqualTo("Is equal to"));
        });
    });
0
Ivan Danchev
Telerik team
answered on 13 Apr 2020, 12:26 PM

Noah,

This is a valid suggestion. Consider adding it as a feature request in the Feedback Portal: https://feedback.telerik.com/aspnet-mvc

Regards,
Ivan Danchev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Noah
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Noah
Top achievements
Rank 1
Share this question
or