问题描述:

How to set the column header text in runtime in mvc telerik grid.

网友答案:

Have you tried using the .Title() method like in the example below?

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()
相关阅读:
Top