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

Forums / Developing with Sitefinity / unable to store multi selection listbox values from Custom Widget designer

unable to store multi selection listbox values from Custom Widget designer

2 posts, 0 answered
  1. Suneeth
    Suneeth avatar
    2 posts
    Registered:
    06 May 2016
    26 May
    Link to this post

    Hi,

    I have a  multi selection list box  in one of my custom widget designers.  I would like the selected values form this list box to be saved as a list of guid to my controller's property. I cant seem to find any example for this.   I have tried to get the selected values from the list box as a java script array and assign it to the Controller property but it doesn't work. 

     

    =====Custom  Widget designer ascx file=======

    <select size="4"  multiple="multiple" id="NewsTypes" class="rss-listbox valid">
               <option value="63ae86cc-3500-6b76-8c45-ff00006d12a1">Internal News</option>
             <option value="96ae86cc-3500-6b76-8c45-ff00006d12a1">External News</option>
    </select>

     

    =======  Custom Widget designer JS file======================
      applyChanges: function () {
                        var controlData = this._propertyEditor.get_control();
                        var array = [];
                        jQuery('select.rss-listbox :selected').each(function (i, selected) {
                            array[i] = jQuery(selected).val();
                        });
                       controlData.NewsTypes = array;
                    }

     

    =====Custom widget Controller =============

     [Category("Table Data")]
     public List<Guid> NewsTypes { get; set; }

  2. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    07 Dec 2016
    31 May
    Link to this post
    Hello Suneeth,

    Can you provide more information about the issue? What part of the functionality does not work? You can try to create an MVC Widget with designer using Sitefinity Thunder and inspect its designer functionality.

    In addition, are you able to get the selected value/s? Another option is to pass the selected values as string and split them in the controller. Also ensure that the selected values are guids but not string.

    You can attache the widgets or an isolated sample in order to inspect it.

    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
     
2 posts, 0 answered