This question is locked. New answers and comments are not allowed.
Hello,
is there an elegant way to update a TreeView with values from a DropDownList via an AjaxRequest?
I have the following code and no idea how to solve this in a good way:
It would be very cool to get the selected value of the DropDownList into this Method:
Any suggestions?
Regards, Benjamin
is there an elegant way to update a TreeView with values from a DropDownList via an AjaxRequest?
I have the following code and no idea how to solve this in a good way:
<
div
class
=
"editor-label"
>
<%= Html.LabelFor(m => m.ClassificationSystems) %>
</
div
>
<
div
class
=
"editor-field"
>
<%= Html.Telerik().DropDownList()
.Name("systemsDropDown")
.BindTo(Model.ClassificationSystems)
.ClientEvents(events => events.OnChange("systemsDropDown_onChange"))
%>
</
div
>
<
div
class
=
"editor-label"
>
Klassifikation
</
div
>
<
div
class
=
"treeview-container"
>
<%= Html.Telerik().TreeView()
.Name("ClassificationsTreeView")
.BindTo(Model.ClassificationRootNodes, (item, treeViewItem) =>
{
item.Text = treeViewItem.Text;
item.Value = treeViewItem.Value;
item.LoadOnDemand = treeViewItem.LoadOnDemand;
item.Enabled = treeViewItem.Enabled;
})
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Enabled(true)
.Select("_AjaxClassificationsTreeViewBinding", "Home");
})
%>
</
div
>
<
div
class
=
"editor-label"
>
<
input
type
=
"button"
value
=
"Klassifikation bearbeiten"
/>
</
div
>
<
script
type
=
"text/javascript"
>
function systemsDropDown_onChange() {
var treeviewitem = $('#ClassificationsTreeView');
var treeview = treeviewitem.data('tTreeView');
treeview.ajaxRequest(treeviewitem);
}
</
script
>
It would be very cool to get the selected value of the DropDownList into this Method:
[HttpPost]
public
ActionResult _AjaxClassificationsTreeViewBinding(TreeViewItem node)
{
return
new
JsonResult { Data =
new
List<TreeViewItem>() };
}
Any suggestions?
Regards, Benjamin