简体   繁体   中英

Disabling Ajax Cascading Dropdown

I have 4 Ajax Toolkit cascading dropdowns on my page.

Under certain conditions on load I set the selected values on the first 2. I now want to disable the first 2 dropdowns in these conditions so they still function but the user cant change the selected value. I've tried setting enabled to false on the dropdown box but it seems the Cascading extender overrides this and sets it back to true. I've also tried setting enabled to false on the extender but this causes the dropdown and child dropdowns not to be populated.

Before I start attempting a javascript solution is there another way of doing this?

Thanks

I achieved this by adding a custom attribute server side to the controls stating if I wanted them disabled, I called this MappedControl, I then used the following Javascript to do the disabling

function Level1Populated() {
    if ($("*[id$='ddl_OrganisationalLevel4Id']").attr("MappedControl")) {
        $("*[id$='ddl_OrganisationalLevel4Id']").disabled = true;
    }
}
function pageLoad(sender, args) {  
    $find("ccd_Level1BID").add_populated(Level1Populated);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM