Call custom function from ClientTemplate

2 posts, 1 answers
  1. Jokull
    Jokull avatar
    15 posts
    Member since:
    Oct 2016

    Posted 07 Jan 2017 Link to this post

    I am trying to call a function from the clientTemplate. Here's sample code. I am trying to send the value of RoleName to a translator function. In my Translate() function the value I get is "#= RoleName #" , not the value. Is this possible?

     

    @(Html.Kendo().Grid<SaviUser>()
    .Name("UsersGrid")
    .Columns(columns =>
    {
        columns.Bound(c => c.RoleName).ClientTemplate(@translator.Translate("#= RoleName #")).Title(translator.Translate("ROLE_NAME")).MinScreenWidth(768);
    })

  2. Answer
    Eduardo Serra
    Admin
    Eduardo Serra avatar
    119 posts

    Posted 09 Jan 2017 Link to this post

    Hello Jokull,

    The behavior you describe occurs because the binding expression #=RoleName# is being used here as a string parameter when they should be instead evaluated client-side. 

    I encourage you to take a look at this thread in the Kendo UI Forums, it discusses an scenario similar to yours and was answered by one of the product developers.

    I hope this helps.

    Regards,
    Eduardo Serra
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 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