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

URGENT : How to highlight multiple dates in RadDatePicker

3 Answers 199 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Shiva
Top achievements
Rank 1
Shiva asked on 08 Apr 2011, 07:54 AM
Dear All,

We are using telerik RadDatePicker in our project and we want to highlight some of the dates when user opens up the date picker. Actually, we will fetch few dates from the database to be highlighted in the date picker. For example the dates are  25th March, 28th March and 3rd April. Now as soon as the user clicks on the raddatepicker and open it, these 3 dates should come highlighted by default (let's say with blue background) and these dates should not loose their highlighting untill and unless code executes again and bring fresh dates dates from the database to be highlighted in raddatepicker.

So in a nutshell, we are looking for code to highlight and unhighlight multiple dates in raddatepicker.

Can you please help with some sample code snippet??

Regards,
Shiva

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 13 Apr 2011, 11:50 AM
Hello Shiva,

You should create a DayTemplateSelector and apply it to the Calendar of RadDatePicker using the CalendarStyle property:

<telerik:RadDatePicker.CalendarStyle>
    <Style TargetType="telerik:RadCalendar">
        <Setter Property="DayTemplateSelector" Value="{StaticResource CustomTemplateSelector}" />
    </Style>
</telerik:RadDatePicker.CalendarStyle>

I've attached a simple example to demonstrate the approach. Hope this helps.

All the best,
Yana
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
Hitesh
Top achievements
Rank 1
answered on 29 Feb 2012, 10:37 AM
Hello Yana,

Thanks for your support for Highlighting multiple dates in the Calendar of RadDatePicker.

i have gone through your code and you made a condition like below..

if (content.Date.DayOfWeek == DayOfWeek.Saturday || content.Date.DayOfWeek == DayOfWeek.Sunday)
{
  return this.SpecialTemplate;
}

here i want to call WCF service instead of the "DayOfWeek.Saturday" OR "DayOfWeek.Sunday" conditions.

Problem
In my code, i am calling WCF service for each "content.Date" and checking my conditions. if "condition == true" then "content.Date" should be hightlighted but issue is i am calling WCF service and i am getting result in WCF Completed event so i am not able to set "SpecialTemplate".

can you please check you code with WCF service and suggest me ?

Thanks and Regard,
Hitesh

0
Soudip
Top achievements
Rank 1
answered on 21 Mar 2012, 11:54 AM
Hi! I am facing the same issue. In my requirement, i get the special dates (the ones we need to highlight) in the runtime based on a Combination of a  user selection and a corresponding database call...
How do i set the SpecialTemplate then?
Tags
DatePicker
Asked by
Shiva
Top achievements
Rank 1
Answers by
Yana
Telerik team
Hitesh
Top achievements
Rank 1
Soudip
Top achievements
Rank 1
Share this question
or