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

Rad Filter displaying default en-US date format, even when en-GB culture is specified.

1 Answer 92 Views
Filter
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 14 Jul 2011, 02:26 PM
I've got a radgrid, with a filter setup like so

myGrid = new RadGrid();
myGrid.ID = "ClientBoundGrid";
myGrid.Culture = new System.Globalization.CultureInfo("en-GB");
//...initialise rest of grid
myGridRadFilter = new RadFilter
{
    ID = "myGridFilter",
    FilterContainerID = "ClientBoundGrid",
    Culture = new System.Globalization.CultureInfo("en-GB")
};
 
myGridRadFilter.ApplyExpressions += new EventHandler<RadFilterApplyExpressionsEventArgs>(myGrid_Filter_Apply);

When I add a filter to the on a date column type, I'd expect the date to be in the format appropriate for the culture I use. (DD/MM/YYYY in this case). However when a date is either typed, or selected from the calender popup, it formats itself to the default en-US format (MM/DD/YYYY). Have I missed a step?

On a slightly related question, is it possible to modify the radfilter object to remove the calender and/or time popups from appearing?

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Jul 2011, 01:16 PM
Hello John,

The picker controls that are nested in RadFilter won't inherit their culture out-of-the-box.
I made a simple demo that shows how to set this culture manually. The same project demonstrates also how to hide the unwanted buttons.
RadFilter1.PreRender += (s, a) =>
{
    IEnumerable<RadDateTimePicker> pickers = ControlsOfType<RadDateTimePicker>(RadFilter1).
        Where(p => p.SelectedDate == null).Select(p => p);
    foreach (RadDateTimePicker picker in pickers)
    {
        picker.DatePopupButton.Visible = false;
        picker.TimePopupButton.Style.Add("visibility", "hidden"); //do not set Visible false here
        picker.Culture = RadGrid1.Culture;
    }
};

Hope this helps.

Regards,
Daniel
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Filter
Asked by
John
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or