RadDatePicker display default date

4 posts, 1 answers
  1. Morgan
    Morgan avatar
    4 posts
    Member since:
    Jul 2010

    Posted 27 Jul 2010 Link to this post

    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
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Jul 2010 Link to this post

    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.
  3. Morgan
    Morgan avatar
    4 posts
    Member since:
    Jul 2010

    Posted 28 Jul 2010 Link to this post

    Thanks!
  4. Muthusamy V
    Muthusamy V avatar
    6 posts
    Member since:
    Apr 2010

    Posted 29 Jul 2010 Link to this post

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