脚本管理器阻止主页面菜单

时间:2014-01-24 13:57:11

标签: c# asp.net

我在c#中编写了一个aspx页面,它使用菜单的母版页。在子页面上,我有一个带有更新面板的scriptmanager控件。一切正常但主页面菜单显示为表格而不是菜单格式。从子页面中删除scriptmanager后,将恢复该菜单.Scriptmanger代码是content2部分下的第一个项目。

<asp:Content ID = "Content2" ContentPlaceHolderID = "MainContent" runat="server">
     <h1> Test page 1</h1>
     <asp:ScriptManager ID="ScriptManager" runat="server" />
     <asp:UpdatePanel ID="UpdatePanel" runat="server" />
<ContentTemplate> 

任何帮助将不胜感激。谢谢!

1 个答案:

答案 0 :(得分:0)

在顶部的母版页中试试这个:

 <body>
   <form id="form1" runat="server">
      <asp:ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager> // remove this script manager if you have included script manager in your other page.
// do other stuff.
</form>
</body>

对于单独的页面,请包含您的主文件并尝试:

    <%@ Page Title="" Language="C#" MasterPageFile="~/yourmasterfile.Master" AutoEventWireup="true"
    CodeBehind="yourfile.aspx.cs" Inherits="yourproject.yourfile" culture="auto"  %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MasterPageContent" runat="server">
    <asp:ScriptManager ID="ScriptManager2" runat="server">
    </asp:ScriptManager> // remove this script manager if you have included script manager in master page
    <asp:UpdatePanel ID="updatePannel1" runat="server">
        <ContentTemplate>
     // do your stuff here
 </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>