简体   繁体   English

ASP.net Ajax选项卡容器没有出现

[英]ASP.net Ajax tab container not appearing

I created new web project using VS 2008 with enabled Ajax template with C# and Framework 3.5. 我使用VS 2008创建了新的Web项目,并使用C#和Framework 3.5启用了Ajax模板。

I added Ajax reference to the project and I can see all Ajax toolkit in my tool box. 我在项目中添加了Ajax引用,我可以在工具箱中看到所有Ajax工具包。

The problem that when I add tab container with Tab Panels then run the projects nothing appear on the browser and I tried few browsers. 问题是,当我添加选项卡容器与选项卡面板然后运行项目时,浏览器上没有任何内容,我尝试了几个浏览器。

I'm including my code and I wish that someone would help me. 我包括我的代码,我希望有人能帮助我。

Regards, 问候,

My Code: ................................................................ 我的代码:............................................... .................

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Contacts._Default" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <div>

                <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">

                    <asp:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1">
                        <ContentTemplate>
                          tab 1
                        </ContentTemplate>
                    </asp:TabPanel>

                    <asp:TabPanel runat="server" HeaderText="TabPanel2" ID="TabPanel2">
                        <ContentTemplate>
                          tab 2
                        </ContentTemplate>
                    </asp:TabPanel>

                    <asp:TabPanel runat="server" HeaderText="TabPanel3" ID="TabPanel3">
                        <ContentTemplate>
                          tab 3
                        </ContentTemplate>
                    </asp:TabPanel>

                </asp:TabContainer>

            </div>

        </form>
    </body>
</html>

Instead of using <asp:scriptmanager> , try using <ajaxToolkit:ToolkitScriptManager> . 而不是使用<asp:scriptmanager> <ajaxToolkit:ToolkitScriptManager> <asp:scriptmanager> ,尝试使用<ajaxToolkit:ToolkitScriptManager> I found I had problems with the AJAX Accordion when using the original scriptmanager, so this may be a similar issue. 我发现在使用原始scriptmanager时我遇到了AJAX Accordion的问题,所以这可能是一个类似的问题。

答案是使用<ajaxToolkit:ToolkitScriptManager>而不是<asp:scriptmanager>

Do Not Set first tab to visible=false or 不要将第一个选项卡设置为visible = false或

Or use cheap trick just below tabContainer add javascript 或者在tabContainer下面使用便宜的技巧添加javascript

Basically TabContainer is rendered as a div tag, get the div id and remove style attribute. 基本上TabContainer呈现为div标签,获取div id并删除style属性。 This was not an issue in AjaxControlToolKit1.0.abcd the lower version but only started in version 3.x 这在较低版本的AjaxControlToolKit1.0.abcd中不是问题,但仅在版本3.x中启动

<script type="text/javascript">
    $(document).ready(function () {
        $("#ctl00_content_profileListTab").removeAttr("style");
    });
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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