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

How to highlight current date in DateTimePicker

6 Answers 191 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Shashank
Top achievements
Rank 1
Shashank asked on 19 Feb 2009, 07:00 AM
Hi,
I want to higlight the current date in the rad date time picker,  if a user selects any other date, other than today, today's date should still be highlighted, while he selects other date of his desire. I want to higlight today's date, so that it serves as a reference to user, just in case he forgets what today';s date is. Please help.

Thanks
Shashank

6 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 19 Feb 2009, 07:23 AM
Hi Shashank,

Add SpecialDays as shown below in order to highlight current day in calendar popup of RadDateTimePiker.

ASPX:
<telerik:RadDateTimePicker ID="RadDateTimePicker1" Runat="server" Culture="English (United States)">  
<Calendar> 
    <SpecialDays> 
        <telerik:RadCalendarDay Repeatable="Today" ItemStyle-BackColor="Bisque"/>  
    </SpecialDays> 
</Calendar> 
</telerik:RadDateTimePicker> 

Thanks,
Princy.
0
Shashank
Top achievements
Rank 1
answered on 19 Feb 2009, 08:36 AM
Thanks princy,
works fine.
0
Gregg
Top achievements
Rank 1
answered on 11 May 2009, 08:22 PM
How do you achieve the same if the DateTimePicker is instead created by a GridDateTimeColumn? For example: 

<telerik:GridDateTimeColumn
 PickerType="DateTimePicker"
...
0
Princy
Top achievements
Rank 1
answered on 12 May 2009, 05:35 AM
Hi Gregg,

Try out the following code snippet in order to highlight current date.

ASPX:
 
<telerik:GridDateTimeColumn DataField="BirthDate" HeaderText="BirthDate" SortExpression="BirthDate" UniqueName="BirthDate" PickerType="DateTimePicker" DataType="System.DateTime">  
</telerik:GridDateTimeColumn> 

CS:
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
{  
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
    {  
        GridDataItem dataItem = e.Item as GridDataItem;  
        RadDateTimePicker datepicker = (RadDateTimePicker)dataItem["BirthDate"].Controls[0];  
 
        RadCalendarDay NewDay = new RadCalendarDay();             
        NewDay.Repeatable = RecurringEvents.Today;              
        NewDay.ItemStyle.BackColor = System.Drawing.Color.Bisque;  
        datepicker.SharedCalendar.SpecialDays.Add(NewDay);           
    }  

Thanks,
Princy.
0
Gregg
Top achievements
Rank 1
answered on 12 May 2009, 03:05 PM
That works. Thank you.
0
Ram
Top achievements
Rank 1
answered on 15 Jul 2011, 03:19 PM
Hi princy.
I'm using Raddatetimepicker
Can I acheive this in raddatetimepicker.
Can I place the calender image inside textbox rightside as in my attached pic
Tags
Calendar
Asked by
Shashank
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Shashank
Top achievements
Rank 1
Gregg
Top achievements
Rank 1
Ram
Top achievements
Rank 1
Share this question
or