Tutorial :Manipulating the tree on the client - please advise



Question:

Here is my scenario. I am going to have a page with the treeview displayed. A user can add and delete nodes: when the user clicks on the node, a pop up will come up with a form, where a user will enter data, this data then gets saved into the database, and the pop-up script comes back with the id (from the database). This id needs to get passed to the parent page and the tree needs to be updated on the CLIENT.

When the user is done modifying the tree, they will click on the save button and the tree will be saved in the database.

I am using asp.net webforms, c#.

How should I go about achieving these objectives? The way I see it, I won't need to use ajax as the tree modification is done on the client side. The trick would be to get the pop-up return an id (which comes from the server onto the parent page). Please advise. Should I use TreeView control or a simple tree plugin from say - jQuery? (keep in mind that I will need to submit the parent page to the server and save the data in the tree to the database).

The way I see it, my only option is a Jquery tree. But us it accessible to the aspx page on submit? HELP!


Solution:1

If you are saving the data into the database in the child window, just have it do a post back on the parent window when it closes, this will force the tree to reload from the database, showing the newly inserted data.


Solution:2

Man, I don't know why Ajax wont help you, but in that case yeah jQuery, and then getting the inner html of control you want, then do foreach to get the Tree nodes and save them in a collection then submit them to DB with some web service methods, you can achieve what you want.

But again with AJAX I think it is much more simpler and you wont loose anything.

Sorry for not providing sample.

Hope this helps


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »