如何使用kendo传递和更新数据模型?

时间:2016-04-11 17:25:59

标签: asp.net-mvc kendo-ui

我正在使用kendo,我想通过调用动作控制器来更新网格上的数据" List"采用类型" List"的参数一旦我通过点击保存按钮调用此控制器,没有数据传递给该控制器? 这是我的列表代码

`@model List<PaymentTermsDueModel>
@{
    ViewBag.Title = "List";
    Layout = "~/Views/Shared/_InnerLayout.cshtml";
}

@section pageTitle
{
    <h5>
        <text class="active">
            @WebHelper.LocalResources(this, "PaymentTermsDueList")
        </text>
    </h5>
}

@section breadcrumbs
    {

    <a href="@Url.Action("List", "PaymentTermsDue")" class="btn btn-danger">@WebHelper.LocalResources(this, "Generate") </a>

}


<div class="panel-body">
    <div id="MyGrid" class="@Html.Partial("_kendoStyle")">
    </div>
   @using (Html.BeginForm("List", "PaymentTermsDue", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
   { <input id="create" type="submit" class="btn btn-primary" value="@Resources.General.Save" /> 
   }
</div>@section Scripts
{
    <script>

        //// active side bar menu
        $('#sideMenu_Matters').addClass('active subdrop');

        // get data object
        var ds = new kendo.data.DataSource({
            transport: {
                read: {
                    url: '@Url.Action("PaymentTermsDueList", "PaymentTermsDue")', dataType: "json"
                }

            },
            pageSize: kendoPageSize
        });


        // generate grid
        var grid = $("#MyGrid").kendoGrid({
            dataSource: ds,
            // inject common kendo settings
            @Html.Partial("_kendo_JS_Setting")
            columns:
            [
                { field: "PD_PDNo", width: 100, title: '@WebHelper.LocalResources(this, "PD_PDNo")' },
                { field: "PD_ClientID", width: 100, title: '@WebHelper.LocalResources(this, "PD_ClientID")' }, { field: "CaseNumber", width: 100, title: '@WebHelper.LocalResources(this, "PD_CaseNumber1")' },
                { field: "MatterName", width: 100, title: '@WebHelper.LocalResources(this, "PD_MTNo")' },
                { field: "ContractNo", width: 100, title: '@WebHelper.LocalResources(this, "PD_RtNo")' },
                { field: "PD_Day", width: 100, title: '@WebHelper.LocalResources(this, "PD_Day")', template: "#= kendo.toString(kendo.parseDate(PD_Day, 'yyyy-MM-dd'), 'MM/dd/yyyy') #", groupable: false },
                { field: "CurrencyName", width: 100, title: '@WebHelper.LocalResources(this, "PD_cCurrency")' },
                { field: "PaymentTypeName", width: 100, title: '@WebHelper.LocalResources(this, "PD_cPaymentType")' },
                { field: "PD_AmountJD", width: 100, title: '@WebHelper.LocalResources(this, "PD_AmountJD")' },
                { field: "PD_AmountCurrency", width: 100, title: '@WebHelper.LocalResources(this, "PD_AmountCurrency")' },
                {field: "PD_Posted", width: 100, title: '@WebHelper.LocalResources(this, "PD_Posted")' ,template: '<input type="checkbox" #= PD_Posted ? \'checked="checked"\' : "" # class="chkbx" />'},
                ]
        }).data("kendoGrid");
        // add tooltip
        grid.thead.kendoTooltip({
            filter: "th",
            content: function (e) {
                var target = e.target; // element for which the tooltip is shown
                return $(target).text();
            }
        });

        // view page
        $("#create").click( function () {


        });

    </script>
}
` 

这是我想点击保存按钮

后执行的动作控制器
` [HttpPost]
        public ActionResult List(List<PaymentTermsDueModel> model)
        {
            if (AddInvoice(model))
            {
                RedirectToAction("List", "PaymentTermsDue");
            }
                return View(model);


        }` 

。我的代码工作并调用我想要的特定动作控制器但没有传递数据

[1]:http://i.stack.imgur.com/KPehN.png

你可以帮我吗?

0 个答案:

没有答案