enable all items - JavaScript

2 posts, 1 answers
  1. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 07 Jun 2013 Link to this post

    Hello Friends,

    I've to dynamically & constatly (depending on what user selectes in another dropdown) keep disabling one item. This worked well ... but then if the user selects another item, the former one obiously stays disabled, so I tried to iterate thru all items and explicitly enable each one (if there is a better and efficient possible scenario, please psot with code example)

    Also please let me know how can I "unselect" the item ... as this combobox has checkboxes visible

    I tried following w/o suuceess

    item.select = false;
    ddadditionalCaseTypes.Items[i].Selected = false;

    I am using folllowing code (hopefully this will also provide a good reference like I got referecne from : this post)

               function jsfun_CategoryTypeChanged() {
                var CategoryTypesID, additionalCategoryTypesID, selectedValue, ddadditionalCategoryTypes;
                CategoryTypesID = "#ctl00_ContentPlaceHolder1_ddCategoryTypes";
                additionalCategoryTypesID = "#ctl00_ContentPlaceHolder1_ddAdditionalCategoryTypes";
                ddadditionalCategoryTypes = $find("ctl00_ContentPlaceHolder1_ddAdditionalCategoryTypes");
                var allItems = ddadditionalCategoryTypes.get_items();
                for (var i = 0; i < allItems.get_count(); i++) {
                    var thisItem = ddadditionalCategoryTypes.get_items().getItem(i);
                    if (thisItem != null)
                selectedValue = $(CategoryTypesID).val();
                if (ddadditionalCategoryTypes != null) {
                    var item = ddadditionalCategoryTypes.findItemByValue(selectedValue);
                    if (item != null) {

  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Jun 2013 Link to this post


    I suppose you need to disable the item based on the first combobox selection and enable the former one if select another item. Please have a look into the following code.
    function OnClientSelectedIndexChanged(sender, args)
        var val = args.get_item().get_text(); // get the selected item of first Combobox
        var RadComboBox2 = $find("<%=RadComboBox2.ClientID%>");
        var getallItems = RadComboBox2.get_items();
        for (var i = 0; i < getallItems.get_count(); i++)
       var item = RadComboBox2.findItemByText(val);

  3. DevCraft R3 2016 release webinar banner
Back to Top