URGENT : How to highlight multiple dates in RadDatePicker

4 posts, 0 answers
  1. Shiva
    Shiva avatar
    61 posts
    Member since:
    Oct 2010

    Posted 08 Apr 2011 Link to this post

    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
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 13 Apr 2011 Link to this post

    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
  3. DevCraft banner
  4. Hitesh
    Hitesh avatar
    1 posts
    Member since:
    Dec 2011

    Posted 29 Feb 2012 Link to this post

    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

  5. Soudip
    Soudip avatar
    1 posts
    Member since:
    Nov 2011

    Posted 21 Mar 2012 Link to this post

    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?
Back to Top