Asp.net 使用KendoGrid编辑行

Asp.net 使用KendoGrid编辑行,asp.net,asp.net-mvc,kendo-ui,kendo-grid,Asp.net,Asp.net Mvc,Kendo Ui,Kendo Grid,您好,我有一个使用剑道网格的视图。我正在编辑表格的行,但是得到了错误。下面是我的代码 @(Html.Kendo().Grid<Invoice.Models.ViewModels.Setup.AccountViewModel>() .Name("Account") .Columns(columns => { columns.Bound(p => p.AccountID).Title("ID").Width(250);

您好,我有一个使用剑道网格的视图。我正在编辑表格的行,但是得到了错误。下面是我的代码

@(Html.Kendo().Grid<Invoice.Models.ViewModels.Setup.AccountViewModel>()
    .Name("Account")
    .Columns(columns =>
    {

        columns.Bound(p => p.AccountID).Title("ID").Width(250);

        columns.Bound(p => p.AccountType).Title("Account Type").Width(225);

        columns.Bound(p => p.AccountName).Title("Account Name").Width(225);

        columns.Bound(p => p.Currency).Title("Currency").Width(225);

        columns.Bound(p => p.Status).ClientTemplate("#=data.Status#").Width(225).HtmlAttributes(new {style="text-align:center"});

        //columns.Command(command => command.Custom("Edit").Click("showDetails")).Title("Action").Width(150);

        columns.Command(command => { command.Edit();}).Width(90);

    })
    .ToolBar(toolbar =>
     {
         toolbar.Template(@<text>
            <div class="row-fluid">
                <div class="span1">
                    <div class="toolbar" style="height:25px;">
                        <ul id="menu" style="width:38px; margin-left:22px;" class="span6">
                            <li style="width:36px;">
                                <i class="fa fa-plus"></i>
                                <ul>
                                    @foreach (var account in @ViewBag.AccountType)
                                    {
                                        <li style="width:100px;" class="openid">
                                            @if (@account.Value == "Bank")
                                            {
                                                <label id="Bank1">@account.Value</label>
                                            }
                                            @if (@account.Value == "CreditCard")
                                            {
                                                <label id="Credit">@account.Value</label>
                                            }
                                            @if (@account.Value == "Cash")
                                            {
                                                <label id="Cash1">@account.Value</label>
                                            }
                                        </li>

                                    }
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </text>);
     })

        .Pageable()
        .Sortable()
        .Scrollable()
        .Filterable()
        .HtmlAttributes(new { style = "height:550px;" })
        //.Selectable(selectable => selectable
        //.Mode(GridSelectionMode.Multiple))
        .Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("UpdateAccount"))
        .DataSource(dataSource => dataSource
            .Ajax()

            .Events(events => events.Error("error_handler"))
            //.ServerOperation(true)
            .Model(model => model.Id(p => p.AccountID))
            .Read(read => read.Action("Account_Read", "Setup"))
            .Create(c => c.Action("Account_Create", "Setup"))
            .Update(u => u.Action("Account_Update","Setup"))

        )
        )

请帮帮我

您可以仅为一列设置模板,如下所示:

columns.Bound(p => p.AccountType)
   .Title("Account Type")
   .Width(225)
   .Template(@<img src="./Images/accountIco.png" title="@item.AccountName" />@item.AccountType);
columns.Bound(p=>p.AccountType)
.名称(“账户类型”)
.宽度(225)
.Template(@@item.AccountType);
columns.Bound(p => p.AccountType)
   .Title("Account Type")
   .Width(225)
   .Template(@<img src="./Images/accountIco.png" title="@item.AccountName" />@item.AccountType);