运行时列标题文本MVC Telerik Grid

时间:2012-03-01 03:50:09

标签: asp.net-mvc telerik-grid

如何在mvc telerik网格中设置运行时的列标题文本。

1 个答案:

答案 0 :(得分:2)

您是否尝试过使用.Title()方法,如下例所示?

Html.Telerik().Grid(Model.SearchResults)
        .Name("Report")
        .DataKeys(keys => keys.Add(p => p.RowID))
        .DataBinding(d => d.Ajax()
        .Select("Select", "Report")
        .OperationMode(GridOperationMode.Client))
        .Columns(c =>
        {
            c.Bound(p => p.RowID).Hidden();
            c.Bound(p => p.UserID).Hidden();
            c.Bound(p => p.LastName).Title("Last Name");
            c.Bound(p => p.FirstName).Title("First Name");
            c.Bound(p => p.Address).Title("Address");
        })
        .Resizable(resizing => resizing.Columns(true))
        .Scrollable(c => c.Height("550px"))
        .Sortable()
        .Filterable()
        .Pageable(paging =>
            paging.PageSize(20)
                    .Style(GridPagerStyles.NextPreviousAndNumeric)
                    .Position(GridPagerPosition.Bottom)
        )
        .Footer(true)
        .Reorderable(reorder => reorder.Columns(true))
        .Groupable()