我在Bootstrap上使用了标签:在这个例子中,我有4个标签,并在其中使用一些ASP.NET WebControl,如DropdownLists,Buttons和TextBoxes.当我选择下拉列表项或单击按钮时,丢失了之前和实际选择的选项卡状态,无法恢复它.
<script src="/Scripts/bootstrap-tabs.js" type="text/javascript"></script>
<script>
$(function(){
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
// Get the name of active tab
var activeTab = $(e.target).text();
// Get the name of previous tab
var previousTab = $(e.relatedTarget).text();
$(".active-tab span").html(activeTab);
$(".previous-tab span").html(previousTab);
});
});
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server" GroupingText="Selección Fecha">
<ul id="profileTabs2" class="nav nav-tabs">
<li><a href="#detallepagosactividad" data-toggle="tab">uno</a></li>
<li><a href="#detallefacturacion" data-toggle="tab">dos</a></li>
<li><a href="#detallefacturacion2" data-toggle="tab">tres</a></li>
<li><a href="#detallefacturacion3" data-toggle="tab">cuatro</a></li>
</ul>
<div class="tab-content" id="myTabContent2">
<div id="detallepagosactividad" class="tab-pane fade">
some text
</div>
<div id="detallefacturacion" class="tab-pane fade"> …Run Code Online (Sandbox Code Playgroud)