DatePicker and Javascript

4 posts, 1 answers
  1. Adigard
    Adigard avatar
    61 posts
    Member since:
    Oct 2011

    Posted 25 Jan 2012 Link to this post

    Greetings,

    I need to get the selected date of a RadDateTimePicker within a JS function.

    I already tried to get a reply by searching on this board.
    What i have so far is this :

    var picker = $find("<%= StartDate.ClientID %>");

    Then i need to pass this variable by url like this ( first one works perfectly )
    Problem : it just displays : [OBJECT][OBJECT] instead of the selectedDate when i get to this aspx page.

    window.open("FrequencyByUser.aspx?id=" + this.id + "&Start=" + picker, "fenetre_popup", "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,width=800,height=350"); ;

    Thanks a lot for your help
  2. Adigard
    Adigard avatar
    61 posts
    Member since:
    Oct 2011

    Posted 25 Jan 2012 Link to this post

    Ok , i tried this :

    var picker = $find("<%= StartDate.ClientID %>");
    var date = picker.get_selectedDate();



    but what i get into my URL is Sat Jan 01 2011 00:00:00 GMT+0100
    i need something like : XX/XX/XXXX

    Is it possible?

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Jan 2012 Link to this post

    Hello,

    Try the following.
    JS:
    function OnClientClick()
       {
            var picker = $find("<%= RadDateTimePicker1.ClientID %>");
            var date = picker.get_selectedDate();
            var selecteddate = date.format("MM/dd/yyyy");
            var oWnd = radopen("FrequencyByUser.aspx?SelectedDate=" + selecteddate, "RadWindow1");
       }

    Thanks,
    Princy.
  5. Adigard
    Adigard avatar
    61 posts
    Member since:
    Oct 2011

    Posted 25 Jan 2012 Link to this post

    Thank you it works perfectly
Back to Top