+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Set Value of RadDatePicker in Widget Designer

Set Value of RadDatePicker in Widget Designer

5 posts, 0 answered
  1. Duke3d
    Duke3d avatar
    5 posts
    Registered:
    17 Feb 2012
    22 May 2014
    Link to this post

    I am trying to set the value of a RadDatePicker placed on the Designer of a Sitefinity Widget.

     in the designer JS file I am doing the following:

     jQuery(this.get_startdate()).set_selectedDate(new Date(controlData.StartDate));

     But I am getting 'Undefinied is not a function.

     How can I set the value of a RadDatePicker from the Designer's js file? Any Suggestions?

     Thanks'

  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    06 Dec 2016
    27 May 2014
    Link to this post
    Hello Joe,

    In order to achieve your need, you should add your component property in the GetScriptDescriptors() method inside your designer's C# class:
    descriptor.AddComponentProperty("startdate", this.StartDate.ClientID);

    and not to wrap it in jQuery, just call:
    this.get_startdate().set_selectedDate(new Date(controlData.StartDate));

    Regards,
    Svetoslav Manchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Duke3d
    Duke3d avatar
    5 posts
    Registered:
    17 Feb 2012
    30 May 2014 in reply to Svetoslav Manchev
    Link to this post

    Hi Svetoslav,

    Thanks for the heads up. The issue is that I was using AddElementProperty instead of AddComponentProperty. 

    Now the Date is displayed in the Designer of the Widget.

    But got another issue now. When I hit Save in the Designer of the Widget Nothing happens and I get a js error.

    Uncaught TypeError: Cannot read property 'toLowerCase' of undefined localhost:20593/ScriptResource.axd?d=ut6cYKafol9wWGp3sTJjPxiVlWuTuFB2b62RJz…S-GTV-MtnHQGQQj9K-xUrwFMXcgmgypJx-RgE6nsI_CAchXqC9vdd3Ido4ce0&t=43433ab4:2

     When I changed it back to AddElementProperty in C# the error vanished 

    What do you think the issue is?

    Thanks

  4. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    06 Dec 2016
    31 May 2014
    Link to this post
    Hello Joe,

    You have to use "AddComponentProperty".

    In order to get the value on click Save in the designer you can use:
    var selector = jQuery(this.get_startDateSelector())[0];
    controlData.StartDate = selector.get_selectedDate().toDateString();

    and to set by:
    var startDateString = controlData.StartDate;
    var startDateDate = new Date(startDateString);
    if (startDateDate) {
        jQuery(this.get_startDateSelector())[0].set_selectedDate(startDateDate);
    }
     

    Regards,
    Svetoslav Manchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  5. Duke3d
    Duke3d avatar
    5 posts
    Registered:
    17 Feb 2012
    31 May 2014 in reply to Svetoslav Manchev
    Link to this post

    Hi Svetoslav,

    Works fine now, thanks for the help!

    Regrads,

    Joseph

5 posts, 0 answered