为什么Kendo Dropdownlist一开始无法读取数据
Why Kendo Dropdownlist can not read data initially
我有一个 Kendo 下拉列表如下,
Html.Kendo().DropDownList()
.Name("CountryName")
.HtmlAttributes(new { style = "font-size:8pt;width:110px" })
.DataValueField("Id")
.DataTextField("Description")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("CountryAjax", "Shared");
});
})
Where
[HttpPost]
public ActionResult CountryAjax(string countryId)
{
var countries = this._decodeBL.GetAllCountriesList();
return new JsonResult
{
Data = new SelectList(countries, "Id", "Description", "Canada")
};
}
但是下拉列表是空的。当在 CountryAjax 中设置断点时,它不会停在那里(意味着永远不会执行 CountryAjax)。顺便说一句,此代码适用于 Telerik ASP.Net MVC。问题是什么?谢谢
您没有提供 countryId 参数。如果方法签名是 public ActionResult CountryAjax() 我想它会触发。
我有一个 Kendo 下拉列表如下,
Html.Kendo().DropDownList()
.Name("CountryName")
.HtmlAttributes(new { style = "font-size:8pt;width:110px" })
.DataValueField("Id")
.DataTextField("Description")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("CountryAjax", "Shared");
});
})
Where
[HttpPost]
public ActionResult CountryAjax(string countryId)
{
var countries = this._decodeBL.GetAllCountriesList();
return new JsonResult
{
Data = new SelectList(countries, "Id", "Description", "Canada")
};
}
但是下拉列表是空的。当在 CountryAjax 中设置断点时,它不会停在那里(意味着永远不会执行 CountryAjax)。顺便说一句,此代码适用于 Telerik ASP.Net MVC。问题是什么?谢谢
您没有提供 countryId 参数。如果方法签名是 public ActionResult CountryAjax() 我想它会触发。