如何将ActionLink插入Kendo网格?

时间:2013-10-22 14:24:21

标签: kendo-ui actionlink

我正在尝试使用此代码中的操作链接。害怕我是一个绝对的新手所以需要拼命帮助。 该链接只需调用链接到UnderwriterID的小型管理窗口,该窗口将是UserName。

@(Html.Kendo().Grid<QMS.ViewModels.UnderwriterVM>()
                .Name("Grid1")
                .Columns(columns =>
                {
                    columns.Bound(p => p.PortfolioID).Width(100);
                    columns.Bound(p => p.UnderwriterID).Width(100);
                    columns.Bound(p => p.UWName).Width(100);
                    columns.Bound(p => p.UWLastName).Width(100);
                    columns.Bound(p => p.PremiumAuthority).Width(100);
                    columns.Bound(p => p.DiscountAuthority).Width(100);
                    columns.Bound(p => p.UW_ShortID).Width(100);
                    columns.Bound(p => p.MaxDiscount).Width(100);
                    columns.Template(p => @Html.ActionLink("Manage", "ManageUW", new { pfid = ViewBag.PF, uwid = Model.FirstOrDefault().UserName }));
                    columns.Command(command => { command.Destroy(); }).Width(110);
                })
                .ToolBar(toolbar =>
                    {
                toolbar.Create();
                toolbar.Save();        
                    })
                       //.Pageable()
                .Sortable()
                .Scrollable(scr => scr.Height(430))
                .Filterable()
                .Editable(editable => editable.Mode(GridEditMode.InCell))
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Batch(true)
                    .ServerOperation(false)
                    .Create("Underwriters_Create", "Grid")
                    .Update("Underwriters_Update", "Grid")
                    .Destroy("Underwriters_Destroy", "Grid")
                    .Read("Read_Underwriters", "Grid", new { vPortId = ViewBag.PF} )
                    .Model(model =>
                                {
                                    model.Id(p => p.UnderwriterID);
                                    model.Field(p => p.PortfolioID).DefaultValue(ViewBag.PF);
                                    model.Field(p => p.UWName).Editable(true);
                                    model.Field(p => p.UWLastName).Editable(true);
                                    model.Field(p => p.PremiumAuthority).Editable(true);
                                    model.Field(p => p.DiscountAuthority).Editable(true);
                                }))
                )

2 个答案:

答案 0 :(得分:0)

以下是我的列客户端模板的样子:

columns
   .Bound(p => p.UserName)
   .Title("")
   .Filterable(false)
   .Sortable(false)
   .Width(103)
   .ClientTemplate(Html.ActionLink("<span class=\"k-icon k-i-pencil\"></span>Manage", "ManageUW", "YourController", new { pfid = ViewBag.PF, uwid = "#=UserName#" }, new { @class = "k-button k-button-icontext" }).ToHtmlString());

答案 1 :(得分:-1)

尝试这样的事情

VB代码

.ClientTemplate(Html.ActionLink("Roles", "UserRolesManage", New With {.UserId = "#=UserId#", .UserLogin = "#=UserLogin#"}).ToHtmlString()

C#代码:

.ClientTemplate(@Html.ActionLink("Roles", "UserRolesManage", New {UserId = "#=UserId#", UserLogin = "#=UserLogin#"}).ToHtmlString()