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

RadDatePicker - Highlight today's date on calendar

26 Answers 787 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Siva
Top achievements
Rank 1
Siva asked on 16 Jun 2009, 03:35 PM
Hello,

I am using a RadDatePicker control to select a date. I want to highlight today's date on the calendar pop up. I have read a couple of previous posts related to this. But I could not get my code work. Following is my current RadDatePicker code.

<telerik:RadDatePicker ID="beginDateTimePicker" runat="server" Skin="Vista"
    <DateInput LabelCssClass="radLabelCss_Vista" Skin="Vista" EmptyMessage="mm/dd/yyyy" 
        DateFormat="MM/dd/yyyy"
        <EmptyMessageStyle Font-Italic="True" Font-Size="8pt" /> 
        <HoveredStyle Font-Italic="True" Font-Size="8pt" /> 
    </DateInput> 
    <Calendar Skin="Vista" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" 
        ViewSelectorText="x" ShowOtherMonthsDays="False" ShowRowHeaders="False"
        <SpecialDays> 
            <telerik:RadCalendarDay Repeatable="Today"
                <ItemStyle CssClass="Yellow" /> 
            </telerik:RadCalendarDay> 
        </SpecialDays> 
    </Calendar> 
    <DatePopupButton CssClass="radPopupImage_Vista" /> 
</telerik:RadDatePicker> 

Please help me on this issue.

Thank You,
Siva

26 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Jun 2009, 03:54 PM
Hello Siva,

Please try the following modification:
... 
<ItemStyle CssClass="rcToday" />  

Let me know whether this helps.

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Siva
Top achievements
Rank 1
answered on 16 Jun 2009, 04:19 PM
Hello Daniel,

I tried the modification which you suggested. But it did not work.

Thanks,
Siva

0
Daniel
Telerik team
answered on 16 Jun 2009, 05:05 PM
Hello Siva,

I tried to reproduce the issue locally without avail. Could you modify the attached demo to help me recreate your scenario?

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Siva
Top achievements
Rank 1
answered on 16 Jun 2009, 06:09 PM
Hello Daniel,

I have executed your demo and it did not work either.

In my page I have another RadDatePicker control and a  Button control. In the click event of Button I am showing Telerik report.

I am having all these in the ContentPlaceHolder of my master page.

Thanks,
Siva



0
Siva
Top achievements
Rank 1
answered on 16 Jun 2009, 07:07 PM
Hello Daniel,

Finally I found the problem. I have set the backcolor for RadCalendarDay itemstyle and I could see the date highlighted.

Thanks for your concern and your suggestions.

Thanks,
Siva
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 08 Feb 2011, 01:13 AM
Picking up on this, isn't this behavior to be considered as a bug really? I mean, shouldn,t the RadDatePicker by default be able to display the SelectedDate? To be honest, shouldn't the RadDatePicker just have an "highlight today" option in the SmartTag, as I guess it is something almost everyone would like to do?
0
Daniel
Telerik team
answered on 08 Feb 2011, 12:33 PM
Hello Patrik,
 
I mean, shouldn,t the RadDatePicker by default be able to display the SelectedDate?
RadDatePicker already displays the date that is selected in the date input control.

To be honest, shouldn't the RadDatePicker just have an "highlight today" option in the SmartTag, as I guess it is something almost everyone would like to do?
Indeed this is a good idea, thank you. I will pass it to our development team for consideration.

Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 08 Feb 2011, 02:41 PM
My misstake, what I meant was that it should be able to highlight todays date by default if set, not forcing the developer to have to change backgrounds to see it.
0
Daniel
Telerik team
answered on 11 Feb 2011, 01:37 PM
Hello Patrik,

If there are no unforeseen difficulties we will implement this functionality in some of the next releases of RadControls for ASP.NET AJAX.

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Jonx
Top achievements
Rank 2
answered on 15 Apr 2011, 04:26 PM
I second Patrick, this is a lot of work for something that everybody wants to do by default.

A property to disable this would be nice. To disable, because I think this should be on by default. It's just plain weird to not have the today's day highlighted.

<telerik:RadDatePicker runat="server" ID="datDebut" DatePopupButton-ToolTip="Afficher le calendrier" DateInput-EmptyMessage="Début">
                    <Calendar>
                        <FastNavigationSettings TodayButtonCaption="Aujourd'hui" CancelButtonCaption="Annuler" />
                        <SpecialDays>
                            <telerik:RadCalendarDay Repeatable="Today">
                                <ItemStyle CssClass="rcToday" />
                            </telerik:RadCalendarDay>
                        </SpecialDays>
                    </Calendar>
                </telerik:RadDatePicker>
0
Daniel
Telerik team
answered on 18 Apr 2011, 01:05 PM
Hello John,

We will add an option in the Smart tag's context menu that will allow you to enable/disable the today date with a single mouse click. Please note that we could not make this a default behavior, as it will be a breaking change.

Kind regards,
Daniel
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Jonx
Top achievements
Rank 2
answered on 18 Apr 2011, 01:09 PM
Good news. No problem, I understand,
Thanks,
John.
0
Abhishek
Top achievements
Rank 1
answered on 24 Jun 2011, 01:14 PM
Hi,

I have added RadDatePicker control dynamically.
How can i set today date highlighted?

i have done this.

 

 

Dim datePicker As New RadDatePicker

 

 

 

Dim radCalendarDay As New RadCalendarDay()

 

radCalendarDay.Repeatable =

 

RecurringEvents.Today

 

radCalendarDay.ItemStyle.CssClass =

 

"rcToday"

 

datePicker.Calendar.SpecialDays.Add(radCalendarDay)

0
chris
Top achievements
Rank 1
answered on 26 Oct 2011, 11:05 PM
When will this feature be released?
0
Jonx
Top achievements
Rank 2
answered on 27 Oct 2011, 08:59 AM
Hello Chris,
What feature are you talking about?
Can you be more specific in what you need?
Thank you,
John.
0
chris
Top achievements
Rank 1
answered on 27 Oct 2011, 07:18 PM
Sorry, I replied to @Daniel (http://www.telerik.com/community/forums/aspnet-ajax/calendar/raddatepicker---highlight-today-39-s-date-on-calendar.aspx#1609470), but my post ended up at the bottom.

I was talking about the ability to highlight today's date in the calendar from the smart tag, rather than remembering to copy/paste 5 lines of code every time.
0
Daniel
Telerik team
answered on 31 Oct 2011, 06:41 PM
Hello Chris,

This feature is already implemented. Here is a screenshot:

Best regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Michael Malone
Top achievements
Rank 1
answered on 29 Nov 2011, 06:20 AM
Daniel,

Is there a property to set to do this without having to use the smart tag or the designer? 
0
Princy
Top achievements
Rank 2
answered on 29 Nov 2011, 10:54 AM
Hello,

You can try the following code snippet to highlight today's date.
CS:
protected void Page_Load(object sender, EventArgs e)
   {
     RadCalendarDay day = new RadCalendarDay();
     day.Date = DateTime.Now.Date;
     day.ItemStyle.BackColor = System.Drawing.Color.Red;
     RadDatePicker1.Calendar.SpecialDays.Add(day);
  }

Thanks,
 Princy.
0
Michael Malone
Top achievements
Rank 1
answered on 29 Nov 2011, 05:15 PM
That's a lot of code for something so simple and useful. Are there plans for add a property to do this? Every Calendar control I've used in the past has highlighted Today's date by default. 
0
Daniel
Telerik team
answered on 02 Dec 2011, 02:38 PM
Hello Michael,

Yes, this functionality will be added in a future version of RadControls for ASP.NET AJAX.

Regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 20 Apr 2012, 01:03 PM
Not sure why but it seems this option "Highlight todays date" is not available in the RadDatePicker, just the RadCalendar, why is this? It seems obvious that it should be available in both cases. Have to admit that at the time of writing this, I don't really know the differences between RadCalendar and RadDatePicker but will look into it.

Edit:
Seems like the only difference is that the Calendar is rendered as a full calendar, which should make it useless for any filtering options with RadGrid (well, most at least). If so, this issue still isn't resolved, as the DatePicker doesn't have a "Highlight today" option, at least not what I could find. 
0
Daniel
Telerik team
answered on 25 Apr 2012, 08:58 AM
Hello Patrik,

Yes, this option is available for RadCalendar only. Our developers will implement this option for the picker controls in a future version of RadControls for ASP.NET AJAX.

Kind regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Karrie
Top achievements
Rank 1
answered on 11 Apr 2014, 06:00 PM
We would like to do this (apply a class or a style to 'today' on a RadCalendar), but only do it once for, say, an entire project rather than configuring the style each time we add a RadDatePicker or Calendar.

For example, what if we always want to automatically apply the same CSS class to any SpecialDay added to a calendar object?

What are some techniques for accomplishing this?
0
Daniel
Telerik team
answered on 15 Apr 2014, 01:51 PM
Hello Karrie,

The easiest way to apply the special days to all calendars would be to use an ASP.NET Theme.
How to: Define ASP.NET Page Themes
How to: Apply ASP.NET Themes

.skin file
<%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
 
<telerik:RadCalendar runat="server">
    <SpecialDays>
        <telerik:RadCalendarDay Repeatable="Today">
            <ItemStyle CssClass="rcToday" />
        </telerik:RadCalendarDay>
    </SpecialDays>
</telerik:RadCalendar>

ASP.NET Page directive:
<%@ Page ... Theme="YourThemeName" %>

Let me know if you need more information.

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Eric
Top achievements
Rank 1
answered on 20 Dec 2015, 11:05 AM
This helped a lot with my project. Thank you.
Tags
Calendar
Asked by
Siva
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Siva
Top achievements
Rank 1
improwise
Top achievements
Rank 1
Iron
Iron
Jonx
Top achievements
Rank 2
Abhishek
Top achievements
Rank 1
chris
Top achievements
Rank 1
Michael Malone
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Karrie
Top achievements
Rank 1
Eric
Top achievements
Rank 1
Share this question
or