Wednesday, March 21, 2012

CascadingDropDown needs to fire "SelectedIndexChanged" from client-side

It seems I always end up with more questions than answers...

So...here's the scenario this time.

I've got two dropdownlists, Make (ddlMake) and Model (ddlModel) with a CascadingDropDownExtender attached to ddlModel. Obviously, when the user changes the Make, I need to retrieve the appropriate Models based on the selection. No problem, that part works just fine.

The twist is this: When I load this up into a ModalPopup, a record is going to (pardon the pun) drive what's being populated into ddlMake. I'm using Javascript to .show() my ModalPopup after I've looked up the record, so the code goes a little like this:

function showModal(object)
{
var _ddlMake = document.getElementById("<%= ddlMake.ClientID %>");
var _ddlModel = document.getElementById("<%= ddlModel.ClientID %>");

// Dummy for now, will be pulled from the loaded record
_ddlMake.options[4].selected = true;
_ddlMake._onParentChange(null,null);

var _popup = $find(object);
_popup.show();
}


Some of the posts I've seen suggested the _onParentChange(null,null), but Firebug is barking saying "_ddlMake._onParentChange is not a function". Granted, it's one of the internals of the CascadingDropDown, but others have stated that this is the way to do it.

What I'm wondering is how to do this. I can't believe that I'm the only person to have ever thought of needing to set/fire these events from the client-side. I'd love some help on this one, that's for sure!

Thanks in advance,

Ric

Bump...still needing some help...

No comments:

Post a Comment