我有两个 Kendo DropDownList 输入 . 当您选择第一个 DropDownList 时,它会发送 request ,在获得 response 之后,它会使用此数据激活第二个 DropDownList . 即使我有超过1 data 显示在第二个 DropDownList ..但它只显示一个 .

如果我不使用 cascading 我可以在 DropDownList 上显示所有 datas . 所以我无法弄清楚是什么原因..

Here is my first DropDownList

@(Html.Kendo().DropDownList()
    .Name("firsItemId")
    .OptionLabel("Seçiniz")
    .DataTextField("Name")
    .DataValueField("Id")
    .DataSource(dataSource =>
    {
    dataSource
    .Ajax()
    .Read(read => read.Action("GetAllDataForDropDown", "SomeContr"));
}))

Here is my Second DropDownList

@(Html.Kendo().DropDownList()
   .Name("konuId")
   .OptionLabel("Seçiniz...")
   .DataTextField("Baslik")
   .DataValueField("Id")
   .DataSource(source =>    
   {    
     data.Ajax()
     .Read(read => 
      read.Action("GetSomeDataById","Konu").Data("filterKonus"));
      data.ServerFiltering(false);
   }
 )
   .Enable(false)
   .AutoBind(false)
   .CascadeFrom("firsItemId")
 )

There is script for cascading

<script>

    function filterKonus() {
        return {
            firsItemId:  $("#firsItemId").val()
        };
    }

</script>

Response :

RESPONSE : {"Data":[{"Id":3,"Baslik":"Baslik1"},{"Id":1,"Baslik":"Baslik2"},{"Id":4,"Baslik":"Baslik3"}],"Total":3,"AggregateResults":null,"Errors":null}

There is a weird problem here also.

当我在第一个 DropDownList ( first itemId : 1 and the position is 1 ) 上选择第一个项目时 . 它得到 response 上的 "Id":1 并在第二个 DropDownList 上显示 data {"Id":1,"Baslik":"Baslik2"} 而不是 response 上的第一个 data . 根据第一个 DropDownList 选择 ItemIdPosition 它从 response 获取并填充 data 我不知道..