简体   繁体   中英

Ajax TabContainer tabs not working after issues with visibility

At first I was having problems with forcing the TabContainer to show. Apparantly something caused it to render as 'style="visibility: hidden"' on runtime. However I fixed this by adding style="visibility:visible" to the TabContainer. It looks like this now:

<asp:TabContainer ID="TabContainer1" runat="server" style="visibility:visible">
        <asp:TabPanel ID="TabPanel1" HeaderText="Tab 1" runat="server">  
                <ContentTemplate>  
                    contents of tab 1 <br />  
                    contents of tab 1 <br />  
                    contents of tab 1 <br />  
                </ContentTemplate>  
            </asp:TabPanel>  
            <asp:TabPanel ID="TabPanel2" HeaderText="Tab 2" runat="server">  
                <ContentTemplate>  
                    contents of tab 2 <br />  
                    contents of tab 2 <br />  
                    contents of tab 2 <br />  
                </ContentTemplate>              
            </asp:TabPanel>  
            <asp:TabPanel ID="TabPanel3" HeaderText="Tab 3" runat="server">  
                <ContentTemplate>  
                    contents of tab 3 <br />  
                    contents of tab 3 <br />  
                    contents of tab 3 <br />  
                </ContentTemplate>              
            </asp:TabPanel>  
    </asp:TabContainer>

Now it does show. but whenever I press tab 2 or 3, nothing happens. It still shows 'contents of tab 1'.

How do I fix this? I would love to have a working TabContainer!

您的代码按原样在Visual Studio 2012中对我有用。我唯一要做的就是添加ScriptManager。

 <ajaxToolkit:ToolkitScriptManager runat="server" />

If you are using .net 4.0/4.5, check that you have added AjaxTookitScriptManager (and not ScriptManager usually added in .net 2.0). I ran into the same problem and figured that out from this notes: http://stephenwalther.com/archive/2012/09/20/september-2012-release-of-the-ajax-control-toolkit

Below is an elaborate procedure that worked for me:

  1. Create a new web site/application in VS 2012
  2. Install AjaxToolKit using NuGet (I do mine like this: Tools Menu > Library Package Manager. then in the prompt I type 'Install-Package AjaxControlToolkit' to install it)
  3. In the ToolBox window, right click the Ajax Tools or any preferred folder, Choose Items... > Browse... to the Bin folder where the AjaxToolkit.dll should now exist and add it
  4. Create a new WebForm Drag and drop AjaxTookitlScriptManager to the page
  5. Drag and drop TabControl from the ToolBox. Add tabs to it and set its width, eg to 500px Test and it should work

I have the same problem with the same control Instead of using ScriptManager , try using ToolkitScriptManager . so this may be a similar issue.

<asp:ToolkitScriptManager runat="server">
</asp:ToolkitScriptManager>

if there is a problem pop ups to you , try to re attached the latest realese of Ajax Control toolkit (I had the same problem and it is done by doing this)

http://ajaxcontroltoolkit.codeplex.com/releases/view/116091

I wish I can help :).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM