Active Tab Changed Event in Tab control in AJAX Control Toolkit
By default, when we use the OnActiveTabChanged event in Tab control in AJAX control toolkit it will not call the server side event. There are number of article which says to call doPostback method explicitly to make this event work but making this to work is as simple as calling DropDownList Selected Index changed event. To post to the server when the user changes the active tab we need to set the AutoPostBack property to true.
Refer the below code,
<cc1:TabContainer id="TabContainer1" runat="server" ActiveTabIndex="0"
OnActiveTabChanged="TabContainer1_ActiveTabChanged" AutoPostBack="true">
<cc1:TabPanel runat="server" HeaderText="My Articles" ID="TabPanel1">
<ContentTemplate>
<div style="text-align:center">
</div>
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel runat="server" HeaderText="My Codes" ID="TabPanel2">
<ContentTemplate>
<div style="text-align:center">
</div>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
Codebehind
protected void TabContainer1_ActiveTabChanged(object sender, EventArgs e)
{
}
|