telerik asp.net mvc ui网格组件

时间:2015-08-17 09:49:32

标签: asp.net-mvc kendo-ui telerik-grid telerik-mvc

我的剃须刀视图中有以下代码:

<table class="table table-hover table-striped">
    <thead>
        <tr>
            <th>
                Name
            </th>
            <th>
                Url
            </th>
            <th>

            </th>
        </tr>
    </thead>
    <tbody>
        @if (Model.Count() == 0)
        {
            <tr>
                <td colspan="3">
                    No results found
                </td>
            </tr>
        }
        else
        {
            foreach (var item in Model)
            {
                <tr>
                    <td width="42%">
                        @item.SiteName
                    </td>
                    <td width="42%">
                        <a href="@item.Url" class="app-link" target="_blank">@item.Url</a>
                    </td>
                    <td width="16%" align="right" class="process">
                        <a href="@Url.Action("CreateByApplicationId", "Content", new { applicationId = item.SiteId }, null)" data-toggle="tooltip" data-placement="top" title="Add Content"><i class="fa fa-file-text"></i></a>
                        <a href="@Url.Action("CreateByApplicationId", "Tag", new { applicationId = item.SiteId }, null)" data-toggle="tooltip" data-placement="top" title="Add Tag"><i class="fa fa-tag"></i></a>
                        <a href="@Url.Action("Edit", "Application", new { id = item.SiteId }, null)" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil-square-o"></i></a>
                        <a href="@Url.Action("Delete", "Application", new { id = item.SiteId }, null)" onclick="return confirm('Silmek istediğinize emin misiniz?');" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-times"></i></a>
                    </td>
                </tr>
            }
        }
    </tbody>
</table>

现在我想将表转换为telerik ui grid:

@if (Model.Count() == 0)
{
    <span>No results found</span>
}
else
{
    @(Html.Kendo().Grid(Model)
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(c => c.SiteName).Title("Site");
            columns.Bound(c => c.Url).Title("Url");
            columns.Command(command => command.Custom("Delete").Action("Delete","Site").DataRouteValues(route => route.Add(o => o.SiteId).RouteKey("id")));
        })
        .Sortable()
    )
}

但我找不到像第一个代码片段那样呈现删除按钮的方法:

<a href="@Url.Action("Delete", "Application", new { id = item.SiteId }, null)" onclick="return confirm('Silmek istediğinize emin misiniz?');" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-times"></i></a>

我该怎么做?

提前致谢,

0 个答案:

没有答案