JQuery tabs - select on page reload

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
11/21/2010 8:36:28 PM
Gravatar
Total Posts 111
Matt Millican InternetMill

JQuery tabs - select on page reload

Hi All,

Wondering if anyone knows how to have a specific tab selected when a page is reloaded or posted-back.  Here's what I'm trying to do:

I have an Admin page with 4 tabs, each with a different form in it.  When I post something or select something to edit in tabs 2, 3 or 4, it posts the page back and then defaults to the first tab.  I've been playing with a workaround for it, but I haven't been able to find anything yet.

Hopefully one of you has some ideas.

Thanks,

Matt

11/22/2010 6:47:26 AM
Gravatar
Total Posts 18439

Re: JQuery tabs - select on page reload

Hi Matt,

You cannot really do it using our automatic wiring up of tabs since we are just using a class name and wiring it up with defaults.

You have to keep in mind the stateless request/response nature of web programming and the fact that the jquery tabs is just a container for grouping things that already exist on the page. While it gives the experience of navigating  by clicking tabs, those clicks are not the same as navigating to a new page which produces a new request, inside the tabs everything is already rendered on the first request.

It is possible but still difficult to do if you wire up the jqueryui tabs yourself using a control id you can get more control of the tab settings, but since you generally want to get out of postback after processing it, it would probably require a redirect with  a query string param to keep the tab state from request to request, or a session variable or a cookie or something could be used but each of these has its pros/cons. You can use techniques like that if you need to but the less state you need to track across requests the better. It is a matter of how much complexity are you willing to introduce to save the user a click or two. With nested tabs it gets even more complicated.

Best,

Joe

 

11/23/2010 8:51:58 AM
Gravatar
Total Posts 111
Matt Millican InternetMill

Re: JQuery tabs - select on page reload

Hi Joe,

Thanks for the reply.  I think I'll fore-go the tabs in this instance and try to come up with another way of organizing the admin form.

Thanks again!

Matt

Ps. Sorry I've been MIA lately - been super swamped lately!

12/3/2010 9:27:39 PM
Gravatar
Total Posts 111
Matt Millican InternetMill

Re: JQuery tabs - select on page reload

Hi Joe,

I just thought of something that I'm going to try, that I think will work as a work-around for this.  Put each form (each form under a tab) in an Update Panel, so that it doesn't postback the entire page, but just that panel which you're updating.  Then the page itself will never have to reload and you can keep the current tab selected.

I'll let you know how it turns out once I implement it, probably later this weekend.

Matt

12/4/2010 7:10:47 AM
Gravatar
Total Posts 18439

Re: JQuery tabs - select on page reload

That will work, we do that on the user profile in the newsletter tab. But if you have things inside the UpdatePanel that need to be wired up with javascript they may become unwired after the updatepanel postback. Like using the wysiwyg editors inside updatepanel is problematic for example.

Best,

Joe

12/4/2010 8:29:40 PM
Gravatar
Total Posts 111
Matt Millican InternetMill

Re: JQuery tabs - select on page reload

Ahh, I think that will work perfect actually... The only tab that has wysiwyg editors is the main tab which I wouldn't need to really use panels on, correct?  Time to play with them! :)

Thanks, Joe!

You must sign in to post in the forums. This thread is closed to new posts.