Solved

Ajax Tab Control Disappears when using the OnClientActiveTabChanged Property

Posted on 2010-08-31
2
1,023 Views
Last Modified: 2012-05-10
Scenario:
I am using the AJAX TabControl and have some javascript to control the ActiveTabIndex on postback as I have some Dropdowns in each tab that cause it to revert back to index 0.   So I added some javascript to control this and call it by setting the OnClientActiveTabChanged Property on the Tab Control.  As soon as I do that and run the debugger to test the Entire Tab Control disappears.  For some reason by setting this property cause the control not to be rendered in the browser.   Need some help in finding out why so I can test to see if this javascript will work.  

Here is My Code:

Tab Control:
<cc1:TabContainer ID="TabContainerAdmin" runat="server" OnClientActiveTabChanged="SaveActiveTabIndex" ActiveTabIndex="0" Enabled="true">
        <cc1:TabPanel ID="TabPanelCircuit" runat="server" HeaderText="Manage Circuit Data">

JavaScript

<script type="text/javascript">
function SaveActiveTabIndex(sender, e)
{
var activetabindex = sender.get_activeTab().get_tabIndex();
setCookie(activetabindex);
}
function setCookie(value)
{
document.cookie = “tabIndex=” + escape(value) ;
}

</script>

Code Behind Function called on PageLoad Event

protected void ChangeTabIndex()
    {
        if (Request.Cookies["tabIndex"] != null)
        {
            int index = int.Parse(Server.HtmlEncode(Request.Cookies["tabIndex"].Value));

            if (index > -1 && index < TabContainerAdmin.Tabs.Count)

            {
                TabContainerAdmin.ActiveTabIndex = index;
            }

            else
            {
                TabContainerAdmin.ActiveTabIndex = 0;
            }
        }
    }

0
Comment
Question by:jholmes0724
2 Comments
 
LVL 21

Accepted Solution

by:
masterpass earned 500 total points
ID: 33623856
TabContainerAdmin.ActiveTabIndex has both get and set

so , I think, there is no need for you to store the tab index in the cookie, you can get the active tabindex in the page load by

TabContainerAdmin.ActiveTabIndex
0
 

Author Closing Comment

by:jholmes0724
ID: 33626505
Yes I did come to that conclusion as well.  Thanks for responding.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question