Objective
The tab controls in the ASP.net AJAX control Toolkit are very easy to use, and support for both the server and the client is very good. This article introduces the common interactions between tab and JavaScript through several FAQ, as well as the issues that should be noted.
1. Tabcantainer JavaScript interface
There are a lot of current tab controls, and the Altas tab control is a bit of a very rich JavaScript interface, and very easy to understand and use, generally used in the following groups:
get_headerText//获取标题文字
set_headerText//设置标题文字
get_headerTab//获取标题Tab
set_headerTab//设置标题Tab
get_enabled//启用 TabPanel
set_enabled//禁用TabPanel
get_owner//获取TabPanel父容器
set_owner//设置TabPanel父容器
get_scrollBars//获取滚动条状态
set_scrollBars// 设置滚动条状态
get_tabIndex//获取TabPanel的序号
_get_active//获取当前活动的 TabPanel
_set_active//设置当前活动的TabPanel
All interfaces can be found in the Tabs.js file of the source code:
2. Common example A. Gets the Tabcontainer current active TabPanel
function GetActiveTab(tabControl) {
var ctrl = $find(tabControl);
var activeid = ctrl.get_activeTab().get_tabIndex();
alert(activeid);
}
B. Setting the TabPanel for Tabcontainer Current activity
function SetActiveTab(index) {
var ctrl = $find("TabContainer1");
var tabpanel = ctrl.get_tabs()[index];
ctrl.set_activeTab(tabpanel);
}