This question is locked. New answers and comments are not allowed.
I have a tree view bounded to model.
on runtime i change my repository of data, what i need to do is remove some nodes from the tree view or call the ajax method to rebind the tree view.
i have read this method.but i need some change, like Grid's Rebind.
http://www.telerik.com/community/forums/aspnet-mvc/treeview/client-side-rebind.aspx
i modify the code ,but i found that is not work.
how can i make it work?
View Code:
Controller Code
the best effect i want,the code like this.
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%= Html.Telerik().TreeView()
.Name("AjaxTreeView")
%>
<p>
<button type="submit" onclick="return DataBinding()" class="t-button t-state-default">
ReBind !</button>
</p>
<script type="text/javascript">
function DataBinding() {
var treeview = $('#AjaxTreeView').data('tTreeView');
treeview.bind(filter)//click the button,and use controller method bind the treeview in ajax;
}
</script>
</asp:Content>
best regards
on runtime i change my repository of data, what i need to do is remove some nodes from the tree view or call the ajax method to rebind the tree view.
i have read this method.but i need some change, like Grid's Rebind.
http://www.telerik.com/community/forums/aspnet-mvc/treeview/client-side-rebind.aspx
i modify the code ,but i found that is not work.
how can i make it work?
View Code:
<%= Html.Telerik().TreeView()<br> .Name("AjaxTreeView")<br> .DataBinding(dataBinding => dataBinding<br> .Ajax().Select("AjaxLoading", "Home")<br> )<br> %><br> <br> <p><br> <button type="submit" onclick="return DataBinding()" class="t-button t-state-default"><br> ReBind !</button><br> </p><br><br><br> <script type="text/javascript"><br> function DataBinding() {<br> var treeview = $('#AjaxTreeView').data('tTreeView');<br> treeview.ajaxRequest({ filter: "testfilter" });<br> return false;<br> }<br> </script>Controller Code
[AcceptVerbs(HttpVerbs.Post)]<br> public ActionResult AjaxLoading(TreeViewItemModel node,string filter)<br> {<br> TreeViewItem data = getData(filter);<br><br><br> return new JsonResult { Data = nodes };<br> }the best effect i want,the code like this.
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%= Html.Telerik().TreeView()
.Name("AjaxTreeView")
%>
<p>
<button type="submit" onclick="return DataBinding()" class="t-button t-state-default">
ReBind !</button>
</p>
<script type="text/javascript">
function DataBinding() {
var treeview = $('#AjaxTreeView').data('tTreeView');
treeview.bind(filter)//click the button,and use controller method bind the treeview in ajax;
}
</script>
</asp:Content>
best regards