Search code examples
kendo-gridtelerik-gridtelerik-mvc

Kendo Template anchor tag


How do I have the variable value be in an anchor tag in my grid column server template?

.Columns( columns=> 
{
     columns.Bound(c =>c.Text).Template(@<text href='home/index/#=Text#'><a></a></text>);
})

Solution

  • The simplest way of doing this is changing it to use the ClientTemplate rather than template like so:

    .Columns( columns=> 
    {
         columns.Bound(c =>c.Text).ClientTemplate("<a href='home/index/#=data.Text#'>#=data.Text#</a>");
    })
    

    If you have something a bit more advanced then pulling this out into either a function or a kendoTemplate will make life a lot easier.