How to use bound model data as link text in a grid

2 posts, 1 answers
  1. Kristen
    Kristen avatar
    7 posts
    Member since:
    Dec 2017

    Posted 08 Dec 2017 Link to this post


    I'm very new to kendo and I've been having issues finding some documentation for this. Basically I have the following grid:

                    .Columns(columns =>
                        columns.Bound(c => c.user_name).Title("User Name");                    
                        columns.Bound(c => c.full_name).Title("Name");
                        columns.Bound(c => c.main_phone).Title("Phone");
                        columns.Bound(c =>"E-Mail");
                        columns.Bound(c => c.admin).Title("Admin");
                        columns.Bound(c =>"Active");
                        columns.Bound(c => c.last_login).Title("Last Login").Format("{0:MM/dd/yyyy}");
                    .Pageable(pageable => pageable
                        .PageSizes(new int[] { 10, 20, 50 })
                    .DataSource(dataSource => dataSource
                        .Read(read => read.Action("Users_Read", "Account"))


    What I would like to do is make the user name a link that calls my controller and passes the user id to it. I'm having issues finding a way to use the models user_name parameter for the link text and the models user_id parameter in the url.


  2. Answer
    Georgi avatar
    677 posts

    Posted 12 Dec 2017 Link to this post

    Hello Kristen,

    A possible solution is to use column template:

    columns.Bound(c => c.user_name).Title("User Name").ClientTemplate("<a href='/Controller/Action?username=#=user_name#&id=#=user_id#'>#=user_name#</a>");

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top