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

RadDatePicker display default date

3 Answers 3257 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Morgan
Top achievements
Rank 1
Morgan asked on 27 Jul 2010, 07:09 PM
Hello,

I'm sure there is a very simple solution to my probleme that I am overlooking, but any help would be greatly appreciated.  Basically, I am using the RadDatePicker on a form.  When the form loads it is set to the current date (DateTime.Now), but there is no visual indication of this on the control. I need the RadDatePicker.DateInput.Text to display from the get go and it would be even better if the selected date would be highlighted in the popup calendar as well.  As is, the text only fills in after the user goes in and changes the date(same with the highlight on the calendar date. Is there some property that allows the date to be displayed before the date changes?
 
Thanks in advance,

Morgan

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 28 Jul 2010, 07:23 AM
Hello,


I tried the below code to set a default date for RadDatePicker. It got worked well for me, it shows date in my DateInput and the selected date is highlighted in calendar.

Have you tried this?

protected void Page_Load(object sender, EventArgs e)
{
    RadDatePicker2.SelectedDate = DateTime.Now.Date;    
}


where the aspx is shown below.
<telerik:RadDatePicker ID="RadDatePicker2" runat="server">
</telerik:RadDatePicker>


Regards,
Shinu.
0
Morgan
Top achievements
Rank 1
answered on 28 Jul 2010, 01:47 PM
Thanks!
0
Muthusamy V
Top achievements
Rank 1
answered on 29 Jul 2010, 12:04 PM
Hello Shinu,

Thanks for your code. It worked for me.

I can see the default date in the calendar control when the page loads. But when the date text box inside the calendar control is cleared, the current date is not highlighted in the calendar popup. I want the current date to be highlighted in the calendar popup when the date text box is empty.

I tried with the following codes in both "onpopupshowing" and "ondateselected" client events separately:

                sender._dateInput._initialValue = sender._calendar._lastSelectedDate;
                sender._dateInput._initialValue = cur_date.getMonth()+ 1 + "/" + cur_date.getDate() + "/" + cur_date.getFullYear();
                sender._calendar.FocusedDate = sender._calendar._lastSelectedDate;
                sender._calendar.set_focusedDate(sender._calendar._lastSelectedDate);
                args._popupControl.FocusedDate = sender._calendar._lastSelectedDate;

Nothing worked out...

Can i get some help on this?

Any help would be appreciated.


Thanks in advance,

Muthusamy. V
Tags
Calendar
Asked by
Morgan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Morgan
Top achievements
Rank 1
Muthusamy V
Top achievements
Rank 1
Share this question
or