New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

RadTab Object

The RadTab object is returned by the getTab() method of the RadTabCollection object. It is also exposed by the eventArgs of many client-side events. The following table lists the most important methods of the RadTab object:  

NameParametersReturn TypeDescription
findControlStringObjectReturns the client-side object of the Control with the specified ID nested in the Tab's Template. The ID passed as an argument to the function MUST be the ID attribute of the nested Control.
disablenonenoneDisables the tab if it is enabled. See Example 1.
enablenonenoneEnables the tab if it is disabled.
get_isEnablednoneboolReturns true if both the tab and the tabstrip are enabled. If one of them is disabled, get_isEnabled() will return false.
get_enablednoneboolSame as get_isEnabled.
set_enabledboolnoneSets the enabled state of the tab. See Example 2.
get_tabsnoneRadTabCollectionGets the child tabs of the current tab.
get_nextSiblingnoneRadTabReturns the next sibling of the tab. If the tab is last, returns null.
get_previousSiblingnoneRadTabReturns the previous sibling of the tab. If the tab is first, returns null.
get_parentnoneRadTabStrip or RadTabReturns an instance of the parent object. RadTabStrip if this is a root tab, RadTab if it is a child tab.
get_tabStripnoneRadTabStripReturns an instance of the tabstrip that contains the tab.
get_pageViewnoneRadPageViewReturns the pageview associated with the tab.
get_pageViewIDnonestringReturns the ID of the pageview.
set_pageViewIDstringnoneSets the ID of the pageview.
get_indexnoneIntegerGets the zero based index of the tab inside the parent tabs collection.
get_levelnoneIntegerGets the level of the tab. Root level tabs are first level.
get_attributesnoneCollectionReturns the collection of custom attributes for the tab. See Example 3.
get_visiblenonebooleanReturns true if the tab is visible or false otherwise.
set_visiblebooleannoneShows/Hides a tab.
set_textstring textnoneSets the text of the tab.
get_textnonestring textReturns the text of the tab.
set_valuestring valuenoneSets the Value property of the tab.
get_valuenonestring valueReturns the Value property of the tab.
get_isSeparatornonebooleanReturns true the tab is a separator (sever-side property IsSeparator = true)
get_selectednonebooleanReturns whether the tab is selected.
set_selectedbooleannoneSelects or de-selects the tab on the client. When RenderSelectedPageOnly is set to true for the associated multi page, use click to select a tab.
selectnonenoneSelects the tab on the client. When RenderSelectedPageOnly is set to true for the associated multi page, use click.
unselectnonenoneDe-selects the tab .
get_navigateUrlnonestringGets the URL of the Web page the tab launches.
set_navigateUrlstringnoneSets the navigateURL property of the tab. This is the URL of the Web page the tab launches. The navigateUrl parameter should be passed as an absolute URL on the client side: e.g., http://mydomain.com/default.aspx" not default.aspx`.
get_imageUrlnonestringGets the URL of the image.
set_imageUrlstringnoneSets the URL of the image.
get_hoveredImageUrlnonestringGets the URL of the image displayed when the mouse if over the tab.
set_hoveredImageUrlstringnoneSets the URL of the image displayed when the mouse if over the tab.
get_elementnoneHTML ElementGets the root DOM element of the tab (LI).
get_linkElementnoneHTML ElementGets the anchor DOM element of the tab(A).
get_imageElementnoneHTML ElementGets the image DOM element of the tab. If the server side ImageUrl property is not set,returns null.
get_textElementnoneHTML ElementGets the DOM element of the tab text (SPAN).
get_childListElementnoneHTML ElementGets the DOM element of the list of child tabs (UL).
scrollIntoViewnonenoneScrolls to the tab.
clicknonenoneSimulate user click on a tab. Use to select a tab when RenderSelectedPageOnly is set to true for the associated multi page.

Changes to the tab made using these methods do not persist after a postback unless surrounded by a call to the trackChanges() and the commitChanges() methods of the tab strip object.

Example 1. Disable tab

JavaScript
function disableTab() { 
	var tabStrip = $find("<%= RadTabStrip1.ClientID %>");
	var tab = tabStrip.findTabByText("Paris");
	tab.disable(); 	 
}

Example 2. Enable tab

JavaScript
function enableTab() {  
	var tabStrip = $find( "<%= RadTabStrip1.ClientID %>");
	var tab = tabStrip.findTabByText( "Paris");
	tab.set_enabled(true);
}

Example 3. Access the attributes collection of the tab

JavaScript
function manipulateAttributes() {
	var tabStrip = $find("<%= RadTabStrip1.ClientID %>");
	var foundTab = tabStrip.findTabByAttribute( "Population", "0");
	var attributes = foundTab.get_attributes();
	var size = attributes.getAttribute( "size");
	if (size) {
		attributes.setAttribute( "Population", size);
		attributes.removeAttribute( "size");
	} else {
		attributes.setAttribute( "Population", "Unknown" );
	} 
}

Example 4. Scroll into view the last tab

JavaScript
function scrollToTheLastTab() {
	var tabStrip = $find("<%=RadTabStrip1.ClientID %>");
	tabStrip.get_tabs().getTab(tabStrip.get_tabs().get_count()-1).scrollIntoView(); 	
}		

See Also

In this article
See Also
Not finding the help you need?
Contact Support