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

Call custom function from ClientTemplate

1 Answer 599 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jokull
Top achievements
Rank 1
Jokull asked on 08 Jan 2017, 02:07 AM

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);
})

1 Answer, 1 is accepted

Sort by
0
Accepted
Eduardo Serra
Telerik team
answered on 09 Jan 2017, 07:05 PM
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.
Tags
Grid
Asked by
Jokull
Top achievements
Rank 1
Answers by
Eduardo Serra
Telerik team
Share this question
or