function
ResetCombo(combo) {
if
(combo) {
combo.clearItems();
combo.set_text(
""
);
}
}
function
LocationSelectedIndexChanged<%= ID %>(sender, eventArgs) {
var
locationCombo = $find(
"<%= rcbLocation.ClientID %>"
);
var
addressCombo = $find(
"<%= rcbAddress.ClientID %>"
);
var
contactCombo = $find(
"<%= rcbContact.ClientID %>"
);
var
contact2Combo = $find(
"<%= rcbContact2.ClientID %>"
);
var
value = locationCombo.get_value();
ResetCombo(addressCombo);
// Items clear on on first index change
ResetCombo(contactCombo);
ResetCombo(contact2Combo);
if
(contactCombo) contactCombo.disable();
if
(contact2Combo) contact2Combo.disable();
if
(value ==
""
)
{
if
(addressCombo) addressCombo.disable();
}
else
{
if
(addressCombo) {
addressCombo.enable();
addressCombo.requestItems(
""
,
false
);
// Fires only on first time index is changed
}
}
}
When this method is called, the text does empty, but the items do no clear. So when the combox is opened, it will not request it's items from the server, which have changed. When the drop down location index is changed, the first time it fires all events. Changing it again calls the methods, but clear items does not work, and request items does not fire.
Note: requestItems fires with "" because it is a custom implementation using context instead of the text of the combo box