We help IT Professionals succeed at work.

How to reset cascading drop down list back to its prompt text?

dpdmembers
dpdmembers asked
on
How to reset cascading drop down list back to its prompt text?  
Comment
Watch Question

The prompttext or promptvalue needs to be set.  The oldvalue attribute contains the previous selection and newvalue attribute contains the new value.

Author

Commented:
I have two cascading drop down controls. Both start off with Please select. I select a value from the parent CC and then the child CC. I then change the parent CC and expect the child to default back to Please Select - but it doesn't. I need to change that behavior.
You need to use ServiceMethod="GetDropDownContents" and defined the function in code behind.  http://www.asp.net/ajaxlibrary/act_CascadingDropdown.ashx

Author

Commented:
I am using all those things,  but child CC is not being reset when I change the parent CC.
could you paste your code

Author

Commented:
Code  Below:

<asp:DropDownList ID="ddlMake" runat="server"/>
<asp:DropDownList ID="ddlModel" runat="server" />
<asp:Panel ID="Panel1" runat="server"></asp:Panel>

<br /><br/>

<ajaxToolkit:CascadingDropDown
ID="CascadingDropDown1"
runat="server"
TargetControlID="ddlMake"
Category="Origin"
PromptText="Select a Country of Origin"
ServicePath="visa_WebService.asmx"
ServiceMethod="CountryOrigin"
LoadingText ="Loading...."  />

<ajaxToolkit:CascadingDropDown
ID="CascadingDropDown2"
runat="server"
ParentControlID="ddlMake"
TargetControlID="ddlModel"
Category="Destination"
PromptText="Select a Country of Destination"
ServicePath="visa_WebService.asmx"
ServiceMethod="CountryDestination"
LoadingText ="Loading...." />
add AutoPostBack="true"  to  <asp:DropDownList ID="ddlMake" runat="server"/>, so it will look like

<asp:DropDownList ID="ddlMake" runat="server" AutoPostBack="true"/>
All AutoPostBack="true" does is to reset the drop down list back to its original prompt, no matter if i change it.

Author

Commented:
No solution given