首页 > 代码库 > MVC使用form传参查询存入前台kendoGrid

MVC使用form传参查询存入前台kendoGrid

<form action="/Project/XiangMuChaXun/Seach" method="post">

<input id="ProjectNumber" name="ProjectNumber">

<button type="submit" class="clearSelection k-button">查询</button>
</form>

.css文件

[HttpPost]
public ActionResult Seach(Seach seach)//model前台存值
{

  string userName = seach.ProjectNumber;//取出

if (dt != null)
{
 var aa = JsonHelpcs.ToJson(dt);
 ViewBag.Data = http://www.mamicode.com/Newtonsoft.Json.JsonConvert.SerializeObject(aa );
}

}

前台JQ取出kendoGrid

<script>
$(function () {
var data = http://www.mamicode.com/[@Html.Raw(ViewBag.Data)];
$("#grid").kendoGrid({
batch: true,
dataSource: data,

height: 550,
groupable: false,
sortable: false,
pageable: {
refresh: false,
pageSizes: false,
buttonCount: 5
},
columns: [{
field: "TASK_ID",
title: "序号",
width: 120
}, {
field: "任务编号",
title: "项目ID"
}

]
});


});
</script>

 

MVC使用form传参查询存入前台kendoGrid