Set date to RadDateTimePicker in Javascript

2 posts, 0 answers
  1. Abhi Shinde
    Abhi Shinde avatar
    56 posts
    Member since:
    May 2010

    Posted 21 Nov 2011 Link to this post

    Hi,
    How can I set date to RadDateTimePicker?

    In browser it shows following error - 

    TypeError: Object [object Object] has no method 'set_selectedDate'

    My Web method returns date - 

    [System.Web.Services.WebMethod]
            public static DateTime Calculate(int type, int noMonths, int noDays, int noOfWeeks, System.DateTime DateOfjoin)
            {
                      return DateTime.Now;
            }

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Nov 2011 Link to this post

    Hello Abhi,

    Try the following javascript.
    JS:
    function OnClientClick()
    {
     var datePicker = $find('<%= RadDateTimePicker1.ClientID %>');
     if (datePicker.isEmpty())
     var date = new Date();
     date.setDate(date.getDate());
     datePicker.set_selectedDate(date);
    }

    Also check the following documentation.
    RadDateTimePicker Client Object

    -Shinu.

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top