This is a migrated thread and some comments may be shown as answers.

Combobox display

1 Answer 58 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
dhuss
Top achievements
Rank 1
dhuss asked on 23 Jul 2012, 10:57 PM
I am using telerik.web.ui v2011.3.1305.35. When you set the checked property for a radCombobox to "true", each item you check creates a concatenated, comma separated list in the display box. This uses the item text of the combo box. How can you do the same thing except display the item "value" in a comma separated list? BTW, this is way cool and made life a lot easier coding wise.

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 24 Jul 2012, 12:30 PM
Hi Dennis,

In order to achieve the desired functionality, you could use the OnClientItemChecked event in the following manner :
<script type="text/javascript">
 
     function OnClientItemChecked(sender, eventArgs) {
 
         var stringValues = "";
         var firstTime = "true";
         var itemsLenght = sender.get_checkedItems().length;
 
         for (i = 0; i < itemsLenght; i++) {
 
             if (firstTime != "true") {
                 stringValues += ",";
             }
 
             firstTime = "false";
 
             stringValues += sender.get_items().getItem(i).get_value();
         }
         
         setTimeout(function () { sender.set_text(stringValues) }, 1);
     }
 
 </script>



All the best,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
dhuss
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or