Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Javascript call with parameter from inside a template

$
0
0

I have the following code that I am trying to use to delete an item in the database when someone clicks the delete button:
 

<scriptid="treeview-template"type="text/kendo-ui-template">
         #: item.name #
         <ahref="javascript:void(0)"class='btn-sm btn-danger'onclick="DeleteNode(@item.id)">x</a>
 </script>
 @Html.Kendo().TreeView().Name("Categories").ExpandAll(true).Template("treeview-template").DataSource(dataSource => dataSource
.Model(model => model
.Id("id")
         .HasChildren("hasChildren")
         )
           .Read(read => read.Action("GetCategories", "Categories"))).DataTextField("name").DragAndDrop(true).Checkboxes(true).Events(events => events.Change("onChange").Select("onSelect").Check("onCheck").Collapse("onCollapse").Expand("onExpand").DragStart("onDragStart").Drag("onDrag").Drop("onDrop").DragEnd("onDragEnd"))

The issue I'm having is that the field I'm trying to pass to the function, @item.id, is causing the exception: "The name 'item' does not exist in the current context." How can I format the code so this works?

Thanks.

Laurie


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>