I have the following code that I am trying to use to delete an item in the database when someone clicks the delete button:
<
script
id
=
"treeview-template"
type
=
"text/kendo-ui-template"
>
#: item.name #
<
a
href
=
"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