Sunday, March 11, 2012

TabContainers ActiveTabChanged event does not fire

Hello,

<script type="text/javascript">
function MyAreaTabActivated(sender, e) {
var tabClickButton = document.getElementById('<%=MyAreatabClickButton.ClientID %>');
if (tabClickButton != null)
{
tabClickButton.click();
}
}

</script>

[...]

<ajaxToolkit:TabContainer runat="server" ID="blahblah" CssClass="MyTabs" width="100%"
<ajaxToolkit:TabPanel runat="server" ID="MyAreaTab" HeaderText="My Area" OnClientClick="MyAreaTabActivated">
<ContentTemplate
<asp:UpdatePanel runat="server" ID="MyAreaUpdatePanel" UpdateMode="Conditional">
<ContentTemplate>
<div style="visibility:hidden"><asp:Button id="MyAreatabClickButton" runat="server" /></div>
</ContentTemplate>
<Triggers>
[...]
</Triggers>
</asp:UpdatePanel
</ContentTemplate>
</ajaxToolkit:TabPanel>

[...]

Then you can use the code behind for the button.click...


Hi Plz check out

In pageload u write this code

Tabs.ActiveTabIndex = Convert.ToInt16(Session("index"))

Protected Sub Tabs_ActiveTabChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Tabs.ActiveTabChanged

If Tabs.ActiveTab.HeaderText = "Prescription" Then
Session("index") = Tabs.ActiveTabIndex
Tabs.AutoPostBack = True
Binddata()
ElseIf Tabs.ActiveTab.HeaderText = "Procedure" Then
Session("index") = Tabs.ActiveTabIndex
Tabs.AutoPostBack = True
Binddata1()
ElseIf Tabs.ActiveTab.HeaderText = "Surgery" Then
Session("index") = Tabs.ActiveTabIndex
Tabs.AutoPostBack = True
Binddata2()
End If

End Sub

Thank u

Baba

Please remember to click "Mark as Answer" on this post if it helped you.


Unfortunately, your code does not help because in order to have the ActiveTabChanged event fire, a postback must occur, and because this does not happen automatically when a tab is selected, JavaScript must be added to the OnClientActiveTabChanged property of the TabContainer to cause the postback. I am trying to figure out exactly what to do to cause this postback, which I am assuming will involve using the GetPostBackEventReference() method.


You may need to upgrade to the latest toolkit. A while back I had the same issue. After upgrading everything worked great. BTW- there are several bug fixes related to tabs that have been fixed in the the most recent release.

Hope this helps.

The server postback click event (ActiveTabChanged) is built in whenAutoPostBack is true...

ProtectedSub Tabs_ActiveTabChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles Tabs.ActiveTabChanged

If Tabs.ActiveTabIndex = 0Then
grdImageMaps.Enabled =True
Else
grdImageMaps.Enabled =False
EndIf

EndSub

You can also fire a client script...

<ajaxToolkit:TabContainerrunat="server"ID="Tabs"
OnClientActiveTabChanged="ActiveTabChanged"
AutoPostBack="true">

function ActiveTabChanged(sender, e)
{
Some javascript goes here...
}

1 comment:

ADmin said...

And with respect to the members of the online paid overviews, it is their authority click here to hold fast to the specified guidelines in place for the template to precisely serve its reason.

Post a Comment