4
I am using the following code to use tabs in my Asp.Net application, is there any way to add an event so that when switching tab run some event on the server side equal to the ajaxcontroltoolkit Tabcontainer event ? (http://www.ajaxcontroltoolkit.com/Tabs/Tabs.aspx)
I’m not using Tabcontainer because I can’t apply Bootstrap to it.
I found the code below but it does on the client side.
https://stackoverflow.com/questions/20705905/bootstrap-3-jquery-event-for-active-tab-change
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href") // activated tab
alert(target);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<ul id="myTab" class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li class=""><a href="#profile" data-toggle="tab">Profile</a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="home">
home tab!
</div>
<div class="tab-pane fade" id="profile">
profile tab!
</div>
</div>
Will the event be synchronous or asynchronous? You can use ajax?
– Richard Dias
ajaxcontroltoolkit.com is your site ? If yes, where Voce hosted ?
– Matheus Miranda
@Matheusmiranda ajaxcontroltoolkit.com is not mine, I just finished the component. It is now maintained by Devexpress: https://www.devexpress.com/products/ajax-control-toolkit/ Documentation: https://github.com/DevExpress/AjaxControlToolkit/wiki
– Mauricio Ferraz