Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvc kendo grid header text

after looking all over the web, i can't find how to set the header text to the kendo grid. for example instead of FName i would like it to sat "First name". maybe one of you guys know?

@(Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.FName).Groupable(false);
        columns.Bound(p => p.ShemIvri) ;
        columns.Bound(p => p.ShemLoazit);        
    })
    .Pageable()
    .Sortable()
    .Scrollable() 
    .Filterable()    
    .DataSource(dataSource => dataSource        
        .Ajax()
        .ServerOperation(false)        
     )
)
like image 214
Itay.B Avatar asked Nov 01 '12 08:11

Itay.B


2 Answers

You are looking for the Title method see also in the documentation

Title
Gets or sets the title of the column.

In your case the code should look like this:

.Columns(columns =>
    {
        columns.Bound(p => p.FName).Title("First name").Groupable(false);
        columns.Bound(p => p.ShemIvri) ;
        columns.Bound(p => p.ShemLoazit);        
    })
like image 184
nemesv Avatar answered Oct 22 '22 09:10

nemesv


or you can put [DisplayName("First Name")] in your model eg:

[DisplayName("First Name")]
        [StringLength(100)]

        public string FName{ get; set; }
like image 35
Supermode Avatar answered Oct 22 '22 11:10

Supermode