当用户选择选项卡时,如何从 TabContainer 获取 ActiveTabIndex?我尝试了以下但不起作用。
<script type="text/javascript">
function TabChange() {
var tc = document.getElementById("TabContainer1")
alert(tc.ActiveTabIndex);
}
</script>
<asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="300px"
Width="300px" CssClass="MyTabStyle" OnClientActiveTabChanged="TabChange">
<asp:TabPanel runat="server" HeaderText="First" ID="TabPanel1">
<ContentTemplate>
<h1>
Tab 1
</h1>
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="TabPanel2" runat="server" HeaderText="Second">
<ContentTemplate>
<h1>
Tab 2
</h1>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>