This is a migrated thread and some comments may be shown as answers.

[Solved] checkedNodes not passed to controller - project attached

1 Answer 78 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bill
Top achievements
Rank 1
Bill asked on 15 Dec 2011, 09:49 PM
Telerik Guru's,

I am having an issue trying to get a treeview that uses client side binding with real data to post the checkedNodes values back to the controller.  The demo example for client side binding is not suitable for me because it uses static data typed right into into the view and I need to fetch my data from the database.  The demo for the checkboxes is binding directly to a model and doesnt demonstrate how to use them without binding immediately to the model.
 
I have modified an example project from an earlier post by adding a new view, "ClientBindPostBackCheckNodes", which demonstrates my problem.  You can contrast it to the working version in the second link which demonstrates it working correctly when binding to a model. If you put a breakpoint at line 67 of the homecontroller, you will see that the checkedNodes parameter is always null whenever you post from the client bound version.

The main difference and culprit is the binding.  I'm binding using an ajax method because the real application im working on will use a dropdown as a filter for the treeview.  I catch the OnChange event of the dropdown, send the selected value to an ajax method which returns a json object, and then bind the treeview to that object.  I'm using a .bindTo(data) method, which I just realized is undocumented.  The documentation lists a .dataBind(data) method but when I attempt to use it, I get an error in the telerik.treeview.min.js file.  I must have found .bindTo() in another example project. 

Can someone please modify the attached project to demonstrate how to properly perform the scenario listed above or even just to get the ClientBindPostBackCheckNodes view to provide the checkedNodes paramater to the controller?

Thanks in advance.

Other questions that could be answered in the demo:
    How to set the mapping for children when using client side binding and dynamic data?  In the example, each level is a is a different type.
    If I had a tree with 20 levels of hierarchy(each level is same type, i.e.from self-referencing table), how would you define that binding?
    Can someone provide documentation for the .bindTo(data) method.

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 19 Dec 2011, 11:05 AM
Hi Bill,

This is a problem that has been addressed in later releases -- I've upgraded the sample application to the official 2011.Q3 release and it works as expected.

Greetings,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
TreeView
Asked by
Bill
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or