Combobox display

2 posts, 0 answers
  1. dhuss
    dhuss avatar
    120 posts
    Member since:
    Sep 2009

    Posted 23 Jul 2012 Link to this post

    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.
  2. Nencho
    Admin
    Nencho avatar
    1808 posts

    Posted 24 Jul 2012 Link to this post

    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.
Back to Top