Template Columns not displaying data

6 posts, 1 answers
  1. Uday
    Uday avatar
    17 posts
    Member since:
    Jun 2014

    Posted 07 Jul 2014 Link to this post


    I am trying to display the a hyperlink for one of the columns in my Grid. I added a template column as per the documentation and it is not displaying any content.

    I check the server response. It does return the data. The column is disappearing on the client side once tied to the Grid.

    Below is the snippet from MVC Grid examples (local-data-binding). I modified a bit to add a template column. You can easily reproduce this by adding the first column to the example at Grid at local-data-binding example.

    @model IEnumerable<Kendo.Mvc.Examples.Models.ProductViewModel>
        .Columns(columns =>
                @Html.ActionLink(item.ProductName, "Local_Data_Binding", "Grid", new { id = item.ProductName }, null)
            </text>).Title("Company Name");
            columns.Bound(p => p.ProductName).Title("Product Name");
            columns.Bound(p => p.UnitPrice).Title("Unit Price").Width(130);
            columns.Bound(p => p.UnitsInStock).Title("Units In Stock").Width(130);
            columns.Bound(p => p.Discontinued).Width(130);
        .DataSource(dataSource => dataSource

    Any suggestions. Looks like this is working for some people.

    Thank You,
  2. Answer
    Dimiter Madjarov
    Dimiter Madjarov avatar
    2310 posts

    Posted 08 Jul 2014 Link to this post

    Hello Uday,

    The reason for the issue is that the current Grid is using an Ajax Bound dataSource, which requires client templates, instead of server ones.
    columns.Template(@<text></text>).ClientTemplate("my template");

    You could take a look at the following page for additional information about displaying an action link in a client template.

    I wish you a great day!

    Dimiter Madjarov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Uday
    Uday avatar
    17 posts
    Member since:
    Jun 2014

    Posted 08 Jul 2014 in reply to Dimiter Madjarov Link to this post

    Thank You. It worked.
  4. Pawel Ch
    Pawel Ch avatar
    6 posts
    Member since:
    May 2015

    Posted 22 Jan 2016 in reply to Dimiter Madjarov Link to this post

    Hi Dimiter

    Answer you provided is proper and it works in this case (Ajax binding). It helped me to solve small problem with client side binding. But example of Ajax binding on the page you refer to is misleading.

    On the page there is a fragment relaed to AJAX as follows:

    For ajax bound grids the ClientTemplate method should be used.
    Example - action link in Ajax bound Grid column
    columns.Bound(p => p.ProductID).ClientTemplate("<a href='" +Url.Action("ProductDetails", "Product") +"/#= ProductID #'" +">Show Product Details</a>"); 

    but this code doesnt work.

    For Ajax bound datagrid client template column code should be like below (I checked both ) :

    "<a href='" +
        Url.Action("ProductDetails", "Product") +
        "/#= ProductID #'" +
    ">Show Product #= ProductID #</a>"


  5. Dimiter Madjarov
    Dimiter Madjarov avatar
    2310 posts

    Posted 27 Jan 2016 Link to this post

    Hello Pawel,

    Both of the provided sample templates will work in an Ajax bound Grid. The first one is for a column bound to a model property. The second one is a pure template column, which is not bound to a property i.e. it cannot be filtered, sorted etc.

    Dimiter Madjarov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Franklin
    Franklin avatar
    3 posts
    Member since:
    Dec 2017

    Posted 11 Jan 2018 Link to this post

    This one worked perfectly for me.

     columns.Bound(client => client.CompanyRow_Id).Title("View Contacts")
                                .ClientTemplate(Ajax.ActionLink("Industry", "Index", "Industry", new { myParam = "#=CompanyRow_Id#" }, new AjaxOptions() { OnSuccess = "myJSFunction" }).ToHtmlString());


    function myJSFunction(response) {





Back to Top