首页 > 解决方案 > 剑道 Telerik TagHelper

问题描述

我在 asp 核心中使用了 kendo Telerik,并在 Html Helpers 中使用了它。但现在我要使用标签助手。谁知道用 TagHelpers 替换我的代码:

HTML 助手:

    @model IEnumerable<Lms.Domain.Models.Group>

    @(Html.Kendo().Grid(Model)
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(c => c.Id);
        columns.Bound(c => c.GroupName);
        columns.Bound(c => c.LibraryId);
        columns.Command(command => { command.Edit(); command.Destroy()});
    })
    .Pageable()
    .Sortable()
    .DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(5)
    .ServerOperation(false)
    .Model(M=>M.Id(c=>c.Id))
    .Read(read=>read.Action("GroupView","Group"))
   )
);

实际上标签助手中的数据绑定有问题吗?

标签: kendo-uitelerikkendo-gridtelerik-grid

解决方案


请参阅下面的代码

        <kendo-grid name="grdName" height="550">
                    <columns>
                        <column field="Id" hidden="true"/>
                        <column field="GroupName" title="Group Name" />
                        <column field="LibraryId" title="Library Id" />
                        <column width="100" title="View/Edit">
                            <commands>
                                <column-command name="custom" text="<span 
  class='fa-1x fa fa-edit' style='color:blue'>
  </span>" click="view"></column-command>
                            </commands>
                        </column>
                    </columns>
                    <toolbar>
                        <toolbar-button name="custom" template="addNewTemplate"> 
                        </toolbar-button>
                    </toolbar>
                    <scrollable enabled="true" />
                    <sortable enabled="true" />
                    <pageable enabled="true" />
                    <filterable enabled="true" />
                    <datasource type="DataSourceTagHelperType.Ajax">
                        <transport>
                     <read url="@Url.Action("GetList", Controller)"/>
                        </transport>
                    </datasource>
                </kendo-grid>

推荐阅读