2011-06-29 49 views
2

我有兩個telerik mvc下拉菜單 - 區域和國家/地區的應用程序。每次區域下拉更改時,我需要使用ASMX Web服務填充國家下拉菜單。換句話說,我需要將一個參數傳遞給Web服務,並從客戶端調用綁定方法。這是我的,但它不工作。如何使用javascript綁定telerik mvc下拉菜單

@(Html.Telerik().DropDownList() 
      .Name("RegionDDL") 
      .BindTo(new SelectList(Model, "value", "value")) 
      .ClientEvents(events => events.OnChange("onChange")) 

     ) 
@(Html.Telerik().DropDownList() 
      .Name("SeasonDDL") 
      .ClientEvents(events => events 
       .OnDataBinding("onDropDownListDataBinding") 
      ) 
      .DataBinding(dataBinding => dataBinding 
      .WebService().Select("~/country.svc/GetSeasonDropDownItems")) 
    ) 

現在腳本

<script type="text/javascript"> 

var RegionDDLv; 

function onChange() { 
     //Get the region 
     RegionDDLv = $("#RegionDDL").data("tDropDownList").value(); 
     var countryDDLv = $("#countryDDL").data("tDropDownList"); 

     countryDDLv.dataBind();//THIS IS NOT WORKING 
} 
function onDropDownListDataBinding(e) { 
     e.data = { region: RegionDDLv }; 
}     
</script> 

感謝

回答

1

嘗試

SeasonDDLv.rebind(); 

,而不是

SeasonDDLv.dataBind();