I'm trying to keep the selected tab, after postback, I'm trying to do it this way:
<script type="text/javascript">
$(function () {
$("#myTabs").tabs({
activate: function () {
var selectedTab = $('#myTabs').tabs('option', 'active');
$("#<%= hdnfldVariable.ClientID %>").val(selectedTab);
},
active: document.getElementById('<%= hdnfldVariable.ClientID %>').value
});
});
</script>
<asp:HiddenField ID="hdnfldVariable" runat="server" />
In addition to changing the layout of the tabs, it still does not work. I have done it in several ways and none works, I use bootstrap on the page. I also tried this function, which also did not work:
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
// Mantém ativa as mesmas tabs do último postBack
var tabAtivaIndex = $('#<%= hdnfldVariable.ClientID %>').val();
$("#myTabs").tabs({ selected: tabAtivaIndex });
});
$(document).ready(function () {
$('#<%= fragment1.ClientID %>').click(function () {
$('#<%= hdnfldVariable.ClientID %>').val("0");
});
$('#<%= fragment2.ClientID %>').click(function () {
$('#<%= hdnfldVariable.ClientID %>').val("1");
});
$('#<%= fragment3.ClientID %>').click(function () {
$('#<%= hdnfldVariable.ClientID %>').val("2");
});
$('#<%= fragment4.ClientID %>').click(function () {
$('#<%= hdnfldVariable.ClientID %>').val("3");
});
$('#<%= fragment5.ClientID %>').click(function () {
$('#<%= hdnfldVariable.ClientID %>').val("4");
});
$('#<%= fragment6.ClientID %>').click(function () {
$('#<%= hdnfldVariable.ClientID %>').val("5");
});
$('#<%= fragment7.ClientID %>').click(function () {
$('#<%= hdnfldVariable.ClientID %>').val("6");
});
$('#<%= fragment8.ClientID %>').click(function () {
$('#<%= hdnfldVariable.ClientID %>').val("7");
});
});
</script>