ASP.NET - Ajax 控件工具包 - TabContainer 始终隐藏
我使用以下代码将 TabContainer 添加到页面
<asp:TabContainer ID="TabContainer1" runat="server">
<asp:TabPanel runat="server" HeaderText="tab one" ID="TabPanel0">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel runat="server" HeaderText="tab two" ID="TabPanel1">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
,但是当页面呈现时 TabPanel 始终隐藏,我通过 Firebug 观看了 html 代码,发现可见性被隐藏...问题是什么? https://i.sstatic.net/m1eSW.jpg
I used the following code to add TabContainer to page
<asp:TabContainer ID="TabContainer1" runat="server">
<asp:TabPanel runat="server" HeaderText="tab one" ID="TabPanel0">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel runat="server" HeaderText="tab two" ID="TabPanel1">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
but when the page is rendered TabPanel is always Hidden,I wateched the html code by Firebug and found visibility is hidden... what is the problem?
https://i.sstatic.net/m1eSW.jpg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您是否尝试过从代码隐藏或aspx设置ActiveTab-Property(来自代码隐藏)或ActiveTabIndex?
如果您明确地将显示设置为可见,您还可以检查它是否有效:
您确定 Ajax 库已正确加载吗?您的 TabContainer 内还有其他 Ajax 控件吗?检查该页面中的所有 html 是否有效。
您是否使用最新的 AjaxToolkit 和 ToolkitScriptManager 而不是 ScriptManger?
Have you tried to set the ActiveTab-Property(from codebehind) or the ActiveTabIndex from codebehind or aspx?
You could also check if it works if you explicitly set the display to visible:
Are you sure that the Ajax libraries are loaded correctly? Do you have other Ajax-Controls inside of your TabContainer? Check if all of your html in that page is valid.
Are you using the latest AjaxToolkit and the ToolkitScriptManager instead of the ScriptManger?
您需要使用 Ajax Control Toolkit 中的脚本管理器,将其添加到表单标记之后。
You need to use the Script Manager from the Ajax Control Toolkit, add it after the form tag.
我遇到了同样的问题,经过 2 小时的谷歌搜索后我找到了解决方案。就我而言,我必须将 asp:ScriptManager 更改为 ajaxToolkit:ToolkitScriptManager。
i had the same issue and after 2 hours of googling i found a solution. In my case I had to change asp:ScriptManager to ajaxToolkit:ToolkitScriptManager.
您可能需要检查是否使用了
ToolkitScriptManager
而不是ScriptManager
。这将解决您的问题。You may want check that you have used
ToolkitScriptManager
instead ofScriptManager
. This will solve your problem.在尝试了网站上找到的所有内容后,我们通过将网站的应用程序池从经典更改为集成来解决了这个问题。
We've solved this problem at our company, after trying everything found on websites by changing the website's appPool from Classic to Integrated.
就我而言:活动选项卡被隐藏(服务器端:
Visible="false"
)。看来如果您在服务器端激活隐藏选项卡,它会将
visibilty:hidden
添加到选项卡容器!In my case: The active tab was hidden (server side:
Visible="false"
).It seems if you activate in server side a hidden tab, it'll add
visibilty:hidden
to the tabcontainer!尝试在 TabContainer 上设置 ActiveTabIndex="0"
Try setting ActiveTabIndex="0" on the TabContainer