Search code examples
c#jqueryasp.netcascadingdropdown

How do i know Cascading Drop Down is loaded


I have used Cascading Drop Downs (for Make and Model) in my web form. I am using webmethod from webservice to bind the CDDs.

Following is the code -

<asp:DropDownList ID="ddlMakes" runat="server" Width="150px">
            </asp:DropDownList>
            <cc1:CascadingDropDown ID="cddMakes"
               runat="server"
               Category="Makes"
               TargetControlID="ddlMakes"
               PromptText="-Select Make-"
               LoadingText="Loading Makes..."
               ServicePath="~/VehicleMakeModelProviderService.asmx"
               ServiceMethod="Service_GetMakes">
            </cc1:CascadingDropDown>


<asp:DropDownList ID="ddlModels" runat="server" Width="150px">
            </asp:DropDownList>
            <cc1:CascadingDropDown ID="cddModels"
               runat="server"
               Category="Models"
               TargetControlID="ddlModels"
               ParentControlID = "ddlMakes"
               PromptText="-Select Models-"
               LoadingText="Loading Models.."
               ServicePath="~/VehicleMakeModelProviderService.asmx"
               ServiceMethod="Service_GetModels">
            </cc1:CascadingDropDown>

I have saved selected values for both the controls in hidden fields. When I am trying to set the selected value on Page_Load and exception is raised. I noticed that this is happening because of the DDLs are filled after entire page is loaded.

Is there any way to know that the DDLs are filled so that i could set the selected value using javascript as well.

Thanks for sharing your time.

Following are some images for your reference. [For some reason i have deleted those images]


Solution

  • Have a look at the ready() handler..might help you.