How can I set the tab on a webpage depending on which page you come from in ASP.Net MVC?

Posted by uriDium on Stack Overflow See other posts from Stack Overflow or by uriDium
Published on 2010-05-04T19:29:04Z Indexed on 2010/05/04 19:48 UTC
Read the original article Hit count: 195

Filed under:
|

I have a rather large entity. It has a parent relationship with many different child tables. Each of the child tables I have represented as a tab (luckily it makes sense and looks nice and makes things easier to navigate). If the users wants to add a new child row, they go the particular tab, and there they see a list of rows which is owned by the parent and they can do the usual CRUD. The CRUD takes them to a new controller and action and passes the ID of the parent to the action. (This is as far as I can tell what I was meant to do, any other ideas??) When they have finsihed they click save and it takes them back to the original page BUT I want it to automatically go to the right tab.

How can I do this? I am using Jquery UI tabs, ASP.Net MVC 2.0. One idea I had was to just go back to the bookmark (the href part with the #, for e.g. /Parent/Details/4/#tabname). Apparently JQuery UI tabs can handle this. Or to set the tab name as part of the query string (/Parent/Details/4?tab=name) What is the best practise here?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about jquery-ui