Search This Blog

Monday, June 4, 2012

how to populate cascading dropdownlist in javascript?

You can force it to populate by setting a different index.
<script type="text/javascript">
function pageLoad()
{
var cde = $find('test_cascade');
cde.set_contextKey("not raymond");
var parent = $get(cde.get_ParentControlID());
var index = parent.selectedIndex;
parent.selectedIndex = -1;
cde._onParentChange(null, false);
parent.selectedIndex = index;
cde._onParentChange(null, false);
}
</script>



<asp:DropDownList id= "ddl_state" runat="server" ></asp:DropdownList>
<asp:DropDownList id= "ddl_dist" runat="server" ></asp:DropdownList>
<ajaxToolkit:CascadingDropDown id="CascadingDropDown1" runat="server" ServicePath="WebService.asmx" ServiceMethod="GetAllDistrict" ParentControlID="ddl_state" TargetControlID="ddl_dist" Category="Districts" UseContextKey="true" LoadingText="Loading District" PromptText="Select a District" BehaviorID="test_cascade"> </ajaxToolkit:CascadingDropDown>

No comments:

Post a Comment