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

Custom Columns Inside Kendo Grid To Trigger a Javascript Function

1 Answer 2618 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Vivek
Top achievements
Rank 1
Vivek asked on 28 Mar 2018, 04:37 AM

I would like to add a custom column to this grid and i tried the template method as in the code below but the code does not even compile and i get thrown an error which i have provided below as well. I want to create a custom column inside the kendo grid and then have a clickable link inside that column which call a javascript function. Is it possible?

@ModelType IEnumerable(Of Gatekeeper.SystemGroupMembers)@Code ViewData("Title") = "DisplayMembers"End Code @(Html.Kendo().Grid(Model) _ .Name("SystemGroupMembers") _ .Columns(Sub(c) c.Bound(Function(p) p.Name) c.Bound(Function(p) p.Class) c.Bound(Function(p) p.ParentName) c.Template(@<text>blah</text>).Title("blah")End Sub) _ .Sortable() _ .DataSource(Sub(c) c.Ajax() _ .ServerOperation(False)End Sub))<div>@Html.ActionLink("Back to List", "DisplayGroups")</div>
Error:
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30201: Expression expected. Source Error: Line 8: .Name("SystemGroupMembers") _ Line 9: .Columns(Sub(c) Line 10: c.Template(@<text>Click here</text>) Line 11: c.Bound(Function(p) p.Name) Line 12: c.Bound(Function(p) p.Class)

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 29 Mar 2018, 10:47 AM
Hi Vivek,

In order to call a JavaScript function from a button or link in a Grid column I would suggest using the approach described in the article below. You should specify ClientTemplate for the column and call the JavaScript function using the template syntax with hash symbols.


Give the approach a try and let me know how it works.

Regards,
Viktor Tachev
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.
Tags
Menu
Asked by
Vivek
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or