如何在Grid.MVC中使用textBoxFor

时间:2018-11-17 18:04:29

标签: asp.net-mvc grid.mvc

我有一个要使用grid.mvc绑定的数据列表。 ,像这样

CSHTML页面:

@model IEnumerable<PrintLabModels.Models.SalesOrderModel>
@using GridMvc.Html;
@using GridMvc.Sorting

<div class="grid">
            <div class="tableStyle">

                @Html.Grid(Model).Named("CoatingJobsGrid").Columns(columns =>
                    {

                        columns.Add(c => c.OrderNo).Titled("Job No").Filterable(true);                      
                        columns.Add(c => c.ProductName).Titled("Product Name").Filterable(true);
                        columns.Add(c => c.CoatingType).Titled("Coating Type").Filterable(true);
                        columns.Add(c => c.CoatingSides).Titled("Coating Sides").Filterable(true);
                        columns.Add(c => c.NoOfCoatingReq).Titled("ToBeCompleted").Filterable(true);

                          columns.Add().Titled("Completed").Filterable(false).RenderValueAs
                          (o => Html.TextBoxFor(m => o.NoOfCoatingCompleted, new {@class="form-control" })).Encoded(false).Sanitized(false);
                   columns.Add().Titled("Update").Filterable(false).RenderValueAs(o => Html.ActionLink(" ", "ApproveCoatingJobs", new { CoatingDescId = o.CoatingDescId, NoOfCoatingCompleted = o.NoOfCoatingCompleted, ControlId = o.ControlId })).Encoded(false).Sanitized(false);
                    })
//here o.NoofCoatingCompleted changed but in controller still getting 0.

            </div>
        </div>

控制器:

 public ActionResult ApproveCoatingJobs(int CoatingDescId, int NoOfCoatingCompleted, int ControlId)
        {
            var model = ProductionManager.ApproveCoatingjob(CoatingDescId, NoOfCoatingCompleted, ControlId);

            return RedirectToAction("CoatingJobs");
        }

enter image description here

我的问题是如何获取更新的“完成的”文本值并将其传递给我的action方法。当我将其发送给Action方法“ ApproveCoatingJobs”时,它只能获取较旧的值(对于“ NoOfCoatingCompleted”),而不更新的文本值。

请帮助。谢谢

0 个答案:

没有答案