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

How to change the skin of the RadDatePicker for RadGrid/GridDateTimeColumn filter

4 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 19 May 2015, 02:06 PM

Hi,

I have a RadGrid with columns of type GridDateTimeColumn. This grid implements filtering.

What I need to do is very simple. I just would like to change the skin of the RadDatePicker. In fact, I would prefer not to specify a skin at all so that the default skin is used. The reason that I want the default (or no skin) is that it show's "today" at the bottom of the calendar and this would be very useful for our users.

At the moment I am playing around with using a FilterTemplate for these columns. However, I am running into some problems. So, before I go any further I am just wondering if there is an easier way to do this? Creating a FilterTemplate just for this (to make the today option appear) seems like a lot of work that might turn out to be unnecessary.

Please let me know.

Thanks,
John.

 

 

4 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 22 May 2015, 07:52 AM
Hello John,

You can achieve this requirement using the following approach
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridFilteringItem)
    {
        GridFilteringItem filterItem = e.Item as GridFilteringItem;
        foreach (GridColumn column in RadGrid1.MasterTableView.RenderColumns)
        {
            if (column is GridDateTimeColumn && (column as GridDateTimeColumn).AllowFiltering)
            {
                RadDatePicker picker = filterItem[column.UniqueName].Controls[0] as RadDatePicker;
                picker.PreRender += (s, a) =>
                {
                    picker.Skin = "Black";
                };
                picker.SharedCalendar.PreRender += (s, a) =>
                {
                    picker.SharedCalendar.Skin = "Black";
                };
            }
        }
    }
}

Hope this helps. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
John
Top achievements
Rank 1
answered on 22 May 2015, 07:55 AM
Thank you very much. I will give it a go today and let you know.
0
Eyup
Telerik team
answered on 22 May 2015, 08:08 AM
Hello John,

Alternatively, you can access the pickers and alter the appearance of the Today date using one of the following approaches:
http://demos.telerik.com/aspnet-ajax/calendar/examples/functionality/today/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/calendar/examples/functionality/specialdays/defaultcs.aspx

Regards,
Eyup
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
John
Top achievements
Rank 1
answered on 28 May 2015, 11:00 AM
Thanks Eyup. That approach to changing the DatePicker works perfectly. I was able to implement a solution based on your suggestion :)
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Eyup
Telerik team
John
Top achievements
Rank 1
Share this question
or