Custom Columns Inside Kendo Grid To Trigger a Javascript Function

2 posts, 0 answers
  1. Vivek
    Vivek avatar
    18 posts
    Member since:
    Apr 2011

    Posted 27 Mar Link to this post

    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)

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1979 posts

    Posted 29 Mar Link to this post

    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.
Back to Top