2011-07-26 56 views
2

TabContainerのプログラムでタブを選択するにはどうすればよいですか?また、どのように選択したタブを取得できますか?TabCointainer(AjaxToolKit)からタブを選択する方法

+0

からスタートタブを注意してください、しかし、私の頭の上から、私はあなたがインデックスを変更するために設定することができますSelectedIndexプロパティを持っています。 – asawyer

答えて

1
ここ

hereから取らTabContainer年代のプロパティの完全なリストである:サンプルコードで

TabContainer Properties 

    ActiveTabChanged (Event) - Fired on the server side when a tab is changed after a 
postback 
    OnClientActiveTabChanged - The name of a javascript function to attach to the 
client-side tabChanged event 
    CssClass - A css class override used to define a custom look and feel for the tabs. 
See the Tabs Theming section for more details. 
    ActiveTabIndex - The first tab to show 
    Height - sets the height of the body of the tabs (does not include the TabPanel 
headers) 
    Width - sets the width of the body of the tabs 
    ScrollBars - Whether to display scrollbars (None, Horizontal, Vertical, Both, Auto) 
in the body of the TabContainer 
    TabStripPlacement - Whether to render the tabs on top of the container or below 
(Top, Bottom) 

便利なリンク:

http://sandblogaspnet.blogspot.com/2009/04/setting-focus-to-particular-tab-in.html

tabContainer = tabContainer.control; 
//Retrieving the tab using the get_activeTab method/property 
var tab = tabContainer.get_activeTab(); 
var headerText = tab.get_headerText(); 
alert(headerText); 
//Another way of retrieving the tab using the get_previousTab method/property 
tab = tabContainer.getPreviousTab(); 
alert(tab.get_tabIndex()); 

3 Tips for Working with the AjaxControlToolkit's TabContainer Control

1
yourTabContainer.ActiveTab = tabIndex; 
+0

これはエラーをスローしてintからAjaxControlToolkit.TabPanelに変換することはできません – user710502

2

あなたが好きなタブインデックスを設定することができます...

tbcName.ActiveTabIndex = 3; 

と同様

tbcName.ActiveTabIndex// Return active tab index 

私はしばらくのものに触れていない、インデックスが0

+0

私の送信ボタンをクリックして、タブ3で、ポストバックではまだ最初のタブに移動しています..私はタブに戻ってきたいインデックスを選択した – user710502

+0

タブコントロールは、ポストバックにタブインデックスを維持していない、これらのリンクをチェックしてくださいhttp://www.codeproject.com/KB/ajax/maintaining-active-tab.aspx http://forums.asp.net /p/1300797/2548838.aspx –

関連する問題