unable to store multi selection listbox values from Custom W

Posted by Community Admin on 04-Aug-2018 13:16

unable to store multi selection listbox values from Custom Widget designer

All Replies

Posted by Community Admin on 26-May-2016 00:00

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;

Posted by Community Admin on 31-May-2016 00:00

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
 

This thread is closed