2011-03-04 38 views
0

我已使用Cascading Drop Downs(適用於品牌和型號)以我的網頁形式顯示。我使用web服務的webmethod來綁定CDD。我如何知道Cascading Drop Down已加載

以下是代碼 -

<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> 

我已經爲這兩個在隱藏字段控件保存選擇的值。當我嘗試在Page_Load上設置選定值並引發異常時。我注意到這是因爲在整個頁面加載完成後填充DDL而發生的。

有什麼辦法可以知道DDL是否被填充,這樣我就可以使用javascript設置選定的值。

感謝分享你的時間。

以下是一些供您參考的圖片。 [出於某種原因,我刪除了這些圖像]

回答

1

看看ready()處理程序..可以幫助你。

+0

謝謝Misnormer !!它正在工作,但是發生的是DDL在DOM加載後被操縱。任何想法? – IrfanRaza 2011-03-04 15:57:01

+0

@ IrfanRaza ..我很抱歉不真正明白你想做什麼..但這裏是一個例子可能參考它並理解需要做什麼 - http://codeasp.net/blogs/sweettam/microsoft-淨/ 1294 /下拉列表操縱-使用-jquery的 – Vishal 2011-03-04 16:08:27