I am trying to create nodes with template that includes @Ajax.ActionLink :
@(Html.Kendo().TreeView()
.Name("actiontree")
.BindTo(Model, (Kendo.Mvc.UI.Fluent.NavigationBindingFactory<TreeViewItem> mappings) =>
{
mappings.For<myspace_menu>(bound => bound.ItemDataBound((node, myspace_menu) =>
{
bool isaco = myspace_menu.controller.Length > 0;
node.Text = myspace_menu.label;
node.ImageUrl = isaco ? Url.Content("~/img/act.png") : Url.Content("~/img/folder.png");
if (isaco)
{
node.Template.InlineTemplate = @<text>@Ajax.ActionLink(myspace_menu.label, "uberitem",
new { c= myspace_menu.controller, a=myspace_menu.action },
new AjaxOptions
{
HttpMethod = "POST",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "accessconfig"
})</text>;
}
})
.Children(e => e.items));
})
)
This actually works - asynchronously updates "accessconfig" div.
However
problem 1: Instead of POST it does GET (but I don't run any javascript and have unobtrusive referenced and enabled ).
problem 2 - main one: inlinetemplate content (link) looks like CHILD node of node I added it into instead of normal appearance (see attached picture).
Also, note I tried version with javascript onselect - it works, but I need to have ajax.ActionLink there.
How can I make inlinetemplate work with Ajax.Actionlink ? How make a link appear as a node text?
thank you !
Denis
@(Html.Kendo().TreeView()
.Name("actiontree")
.BindTo(Model, (Kendo.Mvc.UI.Fluent.NavigationBindingFactory<TreeViewItem> mappings) =>
{
mappings.For<myspace_menu>(bound => bound.ItemDataBound((node, myspace_menu) =>
{
bool isaco = myspace_menu.controller.Length > 0;
node.Text = myspace_menu.label;
node.ImageUrl = isaco ? Url.Content("~/img/act.png") : Url.Content("~/img/folder.png");
if (isaco)
{
node.Template.InlineTemplate = @<text>@Ajax.ActionLink(myspace_menu.label, "uberitem",
new { c= myspace_menu.controller, a=myspace_menu.action },
new AjaxOptions
{
HttpMethod = "POST",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "accessconfig"
})</text>;
}
})
.Children(e => e.items));
})
)
This actually works - asynchronously updates "accessconfig" div.
However
problem 1: Instead of POST it does GET (but I don't run any javascript and have unobtrusive referenced and enabled ).
problem 2 - main one: inlinetemplate content (link) looks like CHILD node of node I added it into instead of normal appearance (see attached picture).
Also, note I tried version with javascript onselect - it works, but I need to have ajax.ActionLink there.
How can I make inlinetemplate work with Ajax.Actionlink ? How make a link appear as a node text?
thank you !
Denis