Set RadComboBox selected item based on Custom Attribute added to Item:Javascript

2 posts, 0 answers
  1. sandeep
    sandeep avatar
    17 posts
    Member since:
    May 2014

    Posted 09 Feb 2015 Link to this post

    Let abc be the combobox
    I have  id,name,serialnumber to each item in radcobobox

        cbItem.set_text(name);/*setting values*/
         cbItem.get_attributes().setAttribute("Serial",serialnumber );

        cbItem.get_value(); /*getting values*/

    we can find items in combo box by


    ????How to find item by  serial(custom attribute) and set the corresponding item as default item to be selected on .document.ready
    Can any one please help me...

  2. Nencho
    Nencho avatar
    1801 posts

    Posted 12 Feb 2015 Link to this post

    Hello Sandeep,

    In order to achieve the desired functionality, you should loop through the items collection at Page Load and check the attribute's value of the currently evaluated items. Once the needed item is found, should set it as selected and break the loop. Please consider the below implementation, using the OnClientLoad client-side event of the RadCombobox:

    <script language="javascript">
                function OnClientLoad(sender) {
                    var combo = sender;
                    var items = combo.get_items();
                    var itemsCount = items.get_count();
                    for (var i = 0; i < itemsCount; i++) {
                        var currItem = items.getItem(i);
                        if (currItem.get_attributes().getAttribute("Serial") == "serial3") {


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top