Call a javascript function from a template passing parameters to the function

2 posts, 0 answers
  1. Juan
    Juan avatar
    1 posts
    Member since:
    Dec 2012

    Posted 17 Apr 2013 Link to this post

    I have a grid that have a template column with an anchor to open a window popup when it is click. I need to pass the id of the line where I'm clicking the anchor, but I can get how to pass that value.

    I'm attaching my code

                    .Resizable(resizable => resizable.Columns(true))
                    .Selectable(selectable => selectable
                    .Columns(columns => {
                        columns.Bound(qr => qr.QuoteRequestId).Hidden();
                        columns.Template(@<text><a href="#" onclick= "OpenNotes(#=QuoteRequestId#)" class = 'k-button k-button-icontext'> Notes </a></text>).Width(100);

  2. Dimiter Madjarov
    Dimiter Madjarov avatar
    2308 posts

    Posted 18 Apr 2013 Link to this post

    Hi Juan,

    This is a quote from my answer in the support thread

    In a server template you could refer to the model for the current row with the item property.

    columns.Bound(p => p.UnitsInStock).Template(@<text><a href="#" onclick= "OpenNotes(@item.CategoryID)">link</a></text>);

    Wish you a great day!

    All the best,
    Dimiter Madjarov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top