views:

149

answers:

1

I have one question regarding using JQuery UI tab control in the asp.net mvc view.

For example, I have three tabs, tab0, tab 1, and tab2 in one aspx page.

Tab1 lists all the products, and tab2 is a form to create a product. After I fill in all the data in tab2 and submit the form. How can I force the view to load tab2. By default, it's always have tab0 selected.

Thanks.

+1  A: 

You can use some jquery to select the tab. You will have to write out this from your view and put it inside a doc ready block

$('#tabs').tabs('option', 'selected', 3);
redsquare
How to "write out this from your view" ? Do I write this in my action method after I finish inserting the product in the DB.
J.W.
Well what is the action returning? A viewresult? if so you can pass in some form of viewdata flag that the view can pick up and write out the js needed/
redsquare
good answer, thank you very much, marked as accepted answer.
J.W.