Sunday, March 11, 2012

CascadingDropDown does not work when selection is made via text link!

Fire the "onchange" event manually after you set the .value. See the end of _setOptions in CascadingDropDownBehavior.js for an example.

Thanks,

I got it working thanks to your post.

Heres my code:

function selectColor(id){

var thisElement = document.getElementById('ctl00_Contentplaceholder2_DropDownList1');
thisElement.selectedIndex = id;

if (document.createEvent) {
var onchangeEvent = document.createEvent('HTMLEvents');
onchangeEvent.initEvent('change', true, false);
thisElement.dispatchEvent(onchangeEvent);
} else if( document.createEventObject ) {
thisElement.fireEvent('onchange');
}
}

No comments:

Post a Comment