Question

The cascading dropdown control works great except that I am unable to figure out a way to reset the dropdown client-side (in Javascript)

My set up is something like this

DD1
DD2
DD3
DD4

each DD is dependent on the previous DD and uses webservice to load them.

On change of DD3 I need to reset DD4 but the previous selection stays.

Can this be done? I tried clearing the value in the supporting hidden input control (cddTest_ClientState) in vain

TIA

Was it helpful?

Solution

Here is the solution

<asp:DropDownList ID="dd1" runat="server" onChange="ondd1ChangeHandler(this)>
</asp:DropDownList>
<asp:DropDownList ID="dd2" runat="server">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cdd2" runat="server" Category="Cat1"
    ParentControlID="dd1" PromptText="(Select Option)" ServiceMethod="GetOptions"
    ServicePath="Services/GetOptions.asmx" TargetControlID="dd2">
</cc1:CascadingDropDown>

<script type='text/javascript>
    function ondd1ChangeHandler(dd){
        var dd2=$get('dd2');
        dd2.selectedIndex=0;
        var cdd=$find('cdd2');
        if(cdd!=null){
            cdd.set_SelectedValue('','');
            cdd._onParentChange(null,false);
        }
    }
</script>

Hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top