@(Html.Kendo().Grid<SW.CRM.WebKendoUI.Models.ServiceOrderViewModel>()
.Name("OrderManegementGrid")
.Columns(columns =>
{
columns.Bound(e => e.Id).Title("订单编号").Visible(false);
columns.Bound(e => e.ReservationNumber).Visible(false);
columns.Bound(e => e.ServiceName).Title("服务名称");
columns.Bound(e => e.FullName).Title("联系人");
columns.Bound(e => e.MobileNumber).Title("手机号");
columns.Bound(e => e.NumberPlate).Title("车牌号");
columns.Bound(e => e.OrderReserveDatetime).Title("预约服务时间").Format("{0:yyyy-MM-dd HH:mm}");
columns.Bound(e => e.IsCanceled).Title("是否取消");
})
.ToolBar(toolbar =>
{
toolbar.Save();
}).HtmlAttributes(new { style = "text-align:center" })
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.Model(model => model.Id(p => p.Id))
.Update("SaveOrderItems", "Orders")
.Read(read => read.Action("GetOrderItems", "Orders", new {Id =@(ViewBag.VehicleModel) }))
)
)
我想通过新的{Id = @(ViewBag.VehicleModel)}将viewBag中的值传递给控制器,但它不起作用。感谢任何建议。
答案 0 :(得分:0)
通过你的Id
,
.Read(read => read.Action("GetOrderItems", "Orders", new { @Id = ViewBag.VehicleModel }))
<强>控制器强>
public ActionResult GetOrderItems([DataSourceRequest]DataSourceRequest request,string Id)
{
}