or
@model Product
@using(Html.BeginForm("InsertProduct","Product"))
{
Html.TextBoxFor(val => val.Name);
Html.TextBoxFor(val => val.Id);
}
<
button
id
=
"addButton"
>Add</
button
>
<
script
type
=
"text/javascript"
>
$(document).ready(function () {
var window = $("#window").kendoWindow({
height: "200px",
modal: true,
title: "Centered Window",
visible: false,
width: "200px"
}).data("kendoWindow");
});
$("#addButton ").click(function () {
var window = $("#window").data("kendoWindow");
window.content("@Html.Partial("PartialViewSample ",new Product()).ToHtmlString()");
window.center();
window.open();
});
@(Html.Kendo().TreeView().Name("treeviewDepartments")
.BindTo(Model.Departments, (NavigationBindingFactory<
TreeViewItem
> mappings) =>
{
mappings.For<
AddDepartmentTreeModel
>(binding => binding.ItemDataBound((item, dapartment) =>
{
item.Text = dapartment.Name;
})
.Children(department => department.Departments));
})
)
function addDepartment()
{
var treeView = $("#treeviewDepartments").data("kendoTreeView");
var selectedNode = treeView.select();
// passing a falsy value as the second append() parameter
// will append the new node to the root group
if (selectedNode.length == 0) {
selectedNode = null;
}
treeView.append({
text: "New department"
}, selectedNode);
}