Hi all,
I have a strange problem with the dnnTabs() jQuery plugin.
Part of the ascx file ([ = <, ] = >):
[div id="TabsPanel" class="dnnForm"] [asp:BulletedList ID="TabHeader" runat="server" CssClass="dnnAdminTabNav" DisplayMode="HyperLink" /] [!-- The rendered output of this looks like [ul class="dnnAdminTabNav"] [li][a href="#Tab1"]Tab 1[/a][/li] [li][a href="#Tab2"]Tab 2[/a][/li] [li][a href="#Tab3"]Tab 3[/a][/li] [/ul] --] [asp:Repeater ID="ContentRepeater" runat="server"] [!-- Here goes a web user control that renders the content, the output is something like [div id="#Tab1" class="dnnClear"] Content Tab 1 [/div] [div id="#Tab2" class="dnnClear"] Content Tab 2 [/div] [div id="#Tab3" class="dnnClear"] Content Tab 3 [/div] --] [/asp:Repeater] [/div]
In the OnPreRender event, I inject some Javascript that renders like this:
jQuery(function ($, sys) { function setUpTabs() { $("#TabsPanel").dnnTabs(); } $(document).ready(function () { setUpTabs(); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function () { setTabs(); }); }); }(jQuery, window.Sys));
That works fine. Now I want to have the second tab activated, e.g. by a value from a query string parameter, or whatever. The rendered script shows as:
jQuery(function ($, sys) { function setUpTabs() { $("#TabsPanel").dnnTabs({ "active": 1 }); } $(document).ready(function () { setUpTabs(); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function () { setTabs(); }); }); }(jQuery, window.Sys));
The tabs are working OK, but instead of Tab 2, there is always the last active tab activated, the same as if I don't pass that value. The value seems to come from a cookie named "dnnTabs-TabsPanel", and the passed value is simply overwritten by the cookie. But even if I remove the cookie, Tab 2 is not activated, but Tab 1 in this case.
Any ideas how to do that?
Happy DNNing!Michael
Sorry, my fault. The correct syntax is
$("#TabsPanel").dnnTabs().tabs({ 'active': x });
These Forums are for the discussion of the open source CMS DNN platform and ecosystem.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.