views:

31

answers:

0

So as the name suggest I have a treeview in an mvc view that persists by its location but sometimes you travel off the route of the tree, for example:

Main page

----Child Page

Say i went to an edit page for the details on the child page, I would still technically be in the child page node but the url for the page is different.

If I use persist: location then it works when I'm on pages that correspond to the links but not when I move to a page not in the list. If I use persiste: cookie then it works if i travel down the nodes but if I use a different link "back" for example then the treeview will remember its previous location and not the new one.

Is there a way using Jquery to get the best of both scenarios, ie, persist by location if the location matches and by cookie if it doesn't?