How to call date picker event in jQuery block?

2 posts, 0 answers
  1. khaled jendi
    khaled jendi avatar
    64 posts
    Member since:
    Mar 2010

    Posted 07 Jan 2015 Link to this post

    Hi, I have this raddatepicker: 

                                                                                           <telerik:RadDatePicker ID="datePicker" runat="server" MinDate="1900-01-01" 
                                                                                                DateInput-Width="217px" Culture="en-GB" 
                                                                                                DateInput-Enabled="false"  Skin="Sunset" Width="247px"  >
                                                                                               <ClientEvents OnDateSelected="getTripsAndHistory" />
                                                                                                <Calendar ID="Calendar3" RangeMinDate="1900-01-01" runat="server" >
                                                                                                    <DateInput Enabled="False" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"></DateInput>
                                                                                                    <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>

    which has <ClientEvents OnDateSelected="getTripsAndHistory" />

    The problem, I need to write the event in jQuery Ready block:

             (function ($) {
                 $(document).ready(function () {

                     function getTripsAndHistory(sender, eventArgs) {
                         var date = eventArgs.get_renderDay().get_date();
                         var dfi = sender.DateTimeFormatInfo;
                         var formattedDate = dfi.FormatDate(date, dfi.ShortDatePattern);
                         alert(formattedDate + " was just " +
                         (eventArgs.get_renderDay().get_isSelected() ? "selected. " : "unselected. "));


    I am getting an error in firebug --> ReferenceError: getTripsAndHistory is not defined
    How can I solve it without removing the event function from jquery ready block?

  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 12 Jan 2015 Link to this post

    Hi Khaled,

    I am afraid that this is not a supported scenario and you need to remove the function which you have assign to DateSelected client even from the document.ready. Generally this function will be executed when a date is selected and if you need to fire it when the control is loaded you can use the OnLoad event. Please check out the following code snippet.
    <telerik:RadDatePicker ID="datePicker" runat="server" MinDate="1900-01-01"
        DateInput-Width="217px" Culture="en-GB" Calendar-ClientEvents-OnLoad="OnLoad"


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top