This is a migrated thread and some comments may be shown as answers.

GRID client template don't work.

3 Answers 185 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karol
Top achievements
Rank 1
Karol asked on 21 Nov 2012, 09:39 AM
Hi all I just want to use ClientTemplate option and I can't get it working:

As you can see:

columns.Bound(p => p.BookId).Width(50).ClientTemplate("Some HTML code");

Insead of this lane I should have "Some HTML code" but I have ID's
@model List<Biblioteka.ViewModels.BookViewModel>
 
@{
    ViewBag.Title = "Index";
}
 
<h2>Index</h2>
 
 
 
@(Html.Kendo().Grid<Biblioteka.ViewModels.BookViewModel>()
    .Name("BooksKendoGrid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Title);
        columns.Bound(p => p.Author);
        columns.Bound(p => p.BookGenreId);
        columns.Bound(p => p.ReleaseDate);
        columns.Bound(p => p.ISBN);
        columns.Bound(p => p.Count);
        columns.Bound(p => p.RealBookCount);
        columns.Bound(p => p.AddDate);
        columns.Bound(p => p.ModifiedDate);
        columns.Bound(p => p.BookId).Width(50).ClientTemplate("Some HTML code");
        //columns.Command(command => { command.Edit(); }).Width(200);
    })
    //.ToolBar(toolbar => toolbar.Create())
     
    // PopUp editing Mode
            .Editable(editable => editable.TemplateName("BooksEditor").Mode(GridEditMode.PopUp))
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()   
    .DataSource(dataSource => dataSource
         
                .Ajax()
                .ServerOperation(false)
                .Model(model =>
                {
                    //The unique identifier (primary key) of the model is the ProductID property
                    model.Id(p => p.BookId);
                })
                 
                   // .Create(create => create.Action("Create", "Books"))
                    .Read(read => read.Action("BooksKendoGridRead", "Books").Type(HttpVerbs.Post)
     )
 
    ).BindTo(Model) 
)

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 26 Nov 2012, 10:00 AM
Hi Karol,

I tried to reproduce the problem locally with the provided code but to no avail – everything is working as expected on our side. Please provide run-able project where the issue is reproduced – hopefully this will help us pinpoint the exact reason for this behavior.

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Eric
Top achievements
Rank 1
answered on 13 Dec 2012, 12:08 AM
I am running into the same problem. It appears that ClientTemplate() is just completely ignored.

I am using MVC 3 with Razor. The Rank column should display "asdf", but instead it just displays the numeric rank.

From my cshtml file:
@using Kendo.Mvc.UI
@model IEnumerable<LccConciergeModel>
            
@{
    ViewBag.Title = "LeaderBoard";
}
 
<h2>LeaderBoard</h2>
 
<div id="grid" style="width:100%">
     
@(Html.Kendo().Grid(Model)
 
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Rank).ClientTemplate("asdf").Width(75);
        columns.Bound(p => p.Points).Width(100);
        columns.Bound(p => p.Name);
        columns.Bound(p => p.NumCalls);
        columns.Bound(p => p.LastCallReceived);
        columns.Bound(p => p.NumTransfers);
        columns.Bound(p => p.LastTransferSale);
        columns.Bound(p => p.TransferPercentage);
    })
    .Pageable()
    .Scrollable()
    .Filterable()
    .DataSource(dataSource => dataSource
    .Ajax()
    .Read(read => read.Action("Read", "LccConciergeController")))
)
 
 
</div>
From the model object:

[Required]
[Display(Name = "Rank")]
public virtual int Rank { get; set; }
Any help is appreciated.

0
Eric
Top achievements
Rank 1
answered on 13 Dec 2012, 07:45 PM
I figured it out. I was using JQuery 1.5.1. I upgraded to 1.8.3 and now ClientTemplate() is not ignored and is functioning properly.
Tags
Grid
Asked by
Karol
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Eric
Top achievements
Rank 1
Share this question
or