I've got a tabstrip with tabs and subtabs. Some of these tabs/subtabs are disabled or invisible. What I'm trying to do is get the next and previous active tab/subtab with reference to the currently selected tab/subtab (if the rightmost tab in a "subtabstrip" is selected then I need to get the next "main" tab). I think this is fairly simple but I'm missing something. Is there some sample code I can look at?
3 Answers, 1 is accepted
0
Hello Neil,
Please find a sample code how to achieve this:
More about RadTab client-side you may find here.
Regards,
Helen
the Telerik team
Please find a sample code how to achieve this:
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
telerik:RadTabStrip
ID
=
"RadTabstrip1"
runat
=
"server"
OnClientTabSelecting
=
"tabSelecting"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab1"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab2"
Selected
=
"true"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 1"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 2"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab3"
Visible
=
"false"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 1"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 2"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 3"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 4"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab4"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab5"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab6"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab7"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
<
script
type
=
"text/javascript"
>
function tabSelecting(sender, eventArgs) {
var tabstrip = $find("<%=RadTabstrip1.ClientID %>");
if (eventArgs.get_tab().get_level() != 0)
{
var parentTab = eventArgs.get_tab().get_parent();
parentTab.get_nextSibling().select();
}
}
</
script
>
More about RadTab client-side you may find here.
Regards,
Helen
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Neil N
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 07 Oct 2010, 02:33 PM
Hi Helen, sorry, I should have specified I need to do this on the server side (in a button clicked event). There seems to be no equivalent to get_nextSibling in the server API.
0
Hello Neil,
It will not so easy to do it server-side. Please find below a sample code to start from:
aspx:
cs:
Hope this helps.
Sincerely yours,
Helen
the Telerik team
It will not so easy to do it server-side. Please find below a sample code to start from:
aspx:
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
telerik:RadTabStrip
ID
=
"RadTabstrip1"
runat
=
"server"
ontabclick
=
"RadTabstrip1_TabClick"
SelectedIndex
=
"1"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab1"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 1"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 2"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab2"
Selected
=
"true"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 1"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 2"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab3"
Visible
=
"false"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 1"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 2"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 3"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 4"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab4"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 1"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 2"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 3"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab5"
Enabled
=
"False"
>
<
Tabs
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 1"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 2"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Child RadTab 3"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab6"
>
</
telerik:RadTab
>
<
telerik:RadTab
runat
=
"server"
Text
=
"Tab7"
>
</
telerik:RadTab
>
</
Tabs
>
</
telerik:RadTabStrip
>
cs:
protected
void
RadTabstrip1_TabClick(
object
sender, Telerik.Web.UI.RadTabStripEventArgs e)
{
if
(e.Tab.Parent.GetType() !=
typeof
(RadTabStrip))
{
RadTab parentTab = (RadTab)e.Tab.Parent;
int
index = parentTab.Index;
do
{
index = index + 1;
}
while
(RadTabstrip1.Tabs[index].Visible ==
false
|| RadTabstrip1.Tabs[index].Enabled ==
false
);
RadTabstrip1.Tabs[index].Selected =
true
;
}
}
Hope this helps.
Sincerely yours,
Helen
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items