Asp.net mvc 4 如何选择剑道下拉列表应填充剑道网格
我尝试了这一点,但从我的控制器数据返回,但没有绑定到剑道网格 这是我的控制器Asp.net mvc 4 如何选择剑道下拉列表应填充剑道网格,asp.net-mvc-4,kendo-grid,kendo-dropdown,Asp.net Mvc 4,Kendo Grid,Kendo Dropdown,我尝试了这一点,但从我的控制器数据返回,但没有绑定到剑道网格 这是我的控制器 public ActionResult Index(string LocationId) { using (var client = new HttpClient()) { IList<AssetsByLocation> _assetCompanyDetailslist; AssetRepository assetr
public ActionResult Index(string LocationId)
{
using (var client = new HttpClient())
{
IList<AssetsByLocation> _assetCompanyDetailslist;
AssetRepository assetrep = new AssetRepository();
Guid LocationID = new Guid();
if (Request.Params["LocationId"] != null)
{
LocationID = new Guid(Request.Params["LocationId"].ToString());
_assetCompanyDetailslist = assetrep.GetAssetsForLocation(LocationID);
var model = _assetCompanyDetailslist;
return View(model);
}
else
{
return View();
}
}
}
这是我在dropdownlist中的活动
.Events(events => events.Change("OnMsgTypeChange"))
这是我的职责
var ddlItem;
function getMsgType() {
return {
LocationId: ddlItem
}
}
function OnMsgTypeChange(e) {
ddlItem = this.value();
$("#Grid").data("kendoGrid").dataSource.read();
}
我终于明白了
public ActionResult Index([DataSourceRequest]DataSourceRequest request, string LocationId)
{
if (Request.Params["LocationId"] != null)
{
using (var client = new HttpClient())
{
AssetRepository assetrep = new AssetRepository();
Guid LocationID = new Guid();
LocationID = new Guid(Request.Params["LocationId"].ToString());
var msgs = assetrep.GetAssetsForLocation(LocationID).ToDataSourceResult(request);
return Json(msgs);
}
}
else
{
return View();
}
}
有人能帮我解决这个问题吗……我想用DataSourceRequest返回json数据
public ActionResult Index([DataSourceRequest]DataSourceRequest request, string LocationId)
{
if (Request.Params["LocationId"] != null)
{
using (var client = new HttpClient())
{
AssetRepository assetrep = new AssetRepository();
Guid LocationID = new Guid();
LocationID = new Guid(Request.Params["LocationId"].ToString());
var msgs = assetrep.GetAssetsForLocation(LocationID).ToDataSourceResult(request);
return Json(msgs);
}
}
else
{
return View();
}
}