2012年3月28日水曜日

Reset a CascadingDropDown control

Can anyone tell me how to reset a group of drop down lists that are grouped together in a CCDD control? I've tried calling dropDownList1.Items.Clear(); but that's not working.

Thanks!

Jason

not sure on this one... but I think you need to call _onParentChange() on the first CascadingDropDownBehavior object... I think you can just set the ID in the CascadingDropDownProperties and then use $object('long_generated_id')._onParentChange( false );

Sorry, but I'm not following... I can't find a method or event _onParentChange for either the CCDD or the DDL itself. I'm also not sure what you mean by $object("long_generated_id"). Where to I get this ID?

Can you provide an example?

Thanks!


Hi Jason,

Jaykul's talking about setting the ID in your CascadingDropDownProperties instance which will cause an ID to be used when it is rendered to the client. However, the ID you use will get mangled and include all the names of its parent naming containers. This mangled ID is what Jaykul was referring to by "long_generated_id." See the MSDN docs onnaming containers for more information. I think one of the easiest ways to find out the long version of the name is to turn tracing on and find it in the control tree.

Thanks,
Ted
$get("<%=ddlCountry.ClientID%>").selectedIndex = 0;

$get("<%=ddlOffice.ClientID%>").selectedIndex = 0;

$get("<%=ddlSalePerson.ClientID%>").selectedIndex = 0;

$find("<%=CascadingDropDown1.ClientID%>")._onParentChange(false);

0 件のコメント:

コメントを投稿