母版页不显示aspx页中的菜单 [英] Master Page doesnt show menu in aspx page

查看:78
本文介绍了母版页不显示aspx页中的菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个带有标题和菜单(垂直顺序)的母版页.在aspx页面中应用此母版页后,它将不显示菜单详细信息.

有什么问题吗?有人可以帮我解决这个问题吗?

这是我的代码

 <   body      ="      样式   margin-top:0; margin-left:50px; margin-right:50px;
背景附件:固定"  > 
    <  表单    ="   form1"    ="  服务器"    ="   off" <   asp:ScriptManager     ID   ="   runat   服务器"  AsyncPostBackTimeout    15000" <      ="   center" 样式  宽度:848px ; vertical-align:top; height:520px" <   tr  > 
                    <   td     ="  宽度:1100px;高度:378px" > 
        <   asp:Panel     ID   ="   runat   服务器"  BackColor   白色"    ="   100%" 样式  高度:545px ;" <   asp:ContentPlaceHolder     ID   ="   runat   服务器" <   asp:Panel     ID   ="   runat   服务器" 宽度   100%"  BackColor   ="     ="   70px" > ; 
                    <      ="  > 
                     <   tr  > 
                            <   td     ="  <   div     ="  <   asp:Image     ID   ="   runat   服务器"  ImageUrl   〜/images/logo1.png" 高度  ="    宽度  ="   ForeColor   白色" ">/ > 
                                    <!-  < span id ="lblHeader" style ="font-size:Larger; font-weight:bold; color:white;> Strike</span>
                                            < span id ="Label1" style ="font-size:Larger; font-weight:bold; color:white;">价格</span>
                                            < span id ="Label2" style ="font-size:Larger; font-weight:bold; color:white;"> .com</span>  ->  
                                   <   asp:LinkBut​​ton     ID   ="   runat   服务器" 字体粗体  真实" 
                     span>                                                      Font-Italic   ="    字体名称  ="    字体大小  ="   Font-Und erline   ="  
 
                     span>                                                      ForeColor   ="    高度  ="     ="  我的帐户" 宽度  ="  <   asp:LinkBut​​ton     ID   ="   runat   服务器"  OnClientClick    statwords('转到登录页面')" 
                     span>                                                             字体大小  ="     ForeColor   ="    文本  ="     ="   50px"   字体名称  ="    字体粗体  ="  True"  OnClick   ="  >  /div  <  > 
                                   <!-  < td align ="right" style =高度:57像素;背景图片:已删除(images/topbg.jpg);>
                                        < asp:标签ID ="days_count" runat =服务器" Visible ="False">
                                        < asp:Label ID ="Label3" runat ="server" Visible ="False" Width ="55px">
                                    </td>  ->  
                        <  /tr  > 
                    <  /table  > 
            <      ="  <   tr  > 
                    <   td     ="  > 
                        <   asp:ContentPlaceHolder     ID   ="   runat   服务器" <      ="  <   tr  > 
           <   td     ="  左" 样式  高度:60像素; width:62px;"  valign   顶部"  > 
        
                <   asp:Menu     ID   ="   runat   服务器" 字体粗体   True" 字体名称  ="     ="   12px" 
                                  ForeColor   ="     ="   方向     宽度  ="    背景色  ="   OnMenuItemClick    Menu1_MenuItemClick " <  静态菜单 样式   背景色  =" #EDA505" / <  静态悬停 样式    forecolor   =" #FFFF80" / > 
                    <  项目 > 
                        <   asp:MenuItem      文本  ="     NewRegistration" <   asp:MenuItem      文本  ="    注册" <   asp:MenuItem      文本  ="     ChangePassword" <   asp:MenuItem      文本  ="    新商品" <   asp:MenuItem      文本  ="    新项目" <   asp:MenuItem    文本  ="      =" 将ExcelTable转换为SqlserverTable" <  /items  > 
                <  /td  > 
        <  /tr  > 
        <  /table  > 
                    <  /td  > 
                  <  /tr  > 
             <  /table  > 
                        <   br    > 
      <  /td  > 
                <  /tr  > 
               <   tr  > 
                 <   td     ="   center"  valign    top"     =" 绿色" 样式  高度:57像素;宽度:80%;" <   div     ="  <   span     ="   style14" 样式  颜色:白色;" <   a     ="  颜色:白色" 标题   StrikeAPrice "  href    http://www.strikeaprice.com"  target   ="  >>  StrikeAPrice <  /a  >  <  /span  <  >  /td  > 
                  <  /tr  > 
           <  /table  > 
    <  /form  > 
<  /body  >  

解决方案

您不会关闭所有标记,并且样式s确保您的母版页的所有代码都不会包含在asp:ContentPlaceHolder标记中.

检查这是我的主人

 <   div      ="  > 
       <   div     ="  <      ="   0" 单元格间距   0" > 
               <   tr  > 
                   <   td  > 
                       <   asp:Menu     ID   ="   runat   服务器" 方向  水平"  BorderStyle   无"                     span>                                  ItemWrap   ="    宽度  ="     CssClass   ="  > 
                           <   StaticMenuStyle     ="   1px" / <   StaticMenuItemStyle     ="  白色"  Horizo​​ntalPadding    1px"   / > 
                           <   DynamicMenuStyle     ="  #e1e1e1" / <   DynamicMenuItemStyle     ="  #3f6080" / <   DynamicMenuStyle     ="   150px" 高度  > 70px"     Horizo​​ntalPadding   ="  15像素" / <  项目 > 
                               <   asp:MenuItem    文本  ="    管理" <   asp:MenuItem    文本  ="    ="     NavigateUrl   =" 〜/RegistrationForm.Aspx"                     span>                                            SeparatorImageUrl="~/images/seprator.jpg"></asp:MenuItem>

                           <  /Items  > 
                       <  /asp:Menu  > 
                   <  /td  > 

               <  /tr  > 
           <  /table  > 
       <  /div  > 
   <  /div  > 
   <   div  > 
       <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">


       <  /asp:contentplaceholder  > 
   <  /div  > 


and one aspx.page which under the that master

<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
          <   > 
                       //your code..........
                  <  /table  > 
        </asp:contentplaceholder>


Hi
I have a master page with header and menu(vertical order).after applying this master page in aspx page it will not show the menu details.

what is the problem?Can any one help me to solve this?

here is my code

<body class="body"  style="margin-top: 0; margin-left: 50px; margin-right: 50px; 
background-attachment: fixed">
    <form id="form1"  runat="server"  autocomplete="off">
        <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="15000">
           
           <table align="center" style="width: 848px; vertical-align:top; height: 520px">
                <tr>
                    <td style="width: 1100px; height: 378px">
        <asp:Panel ID="mainpanel" runat="server" BackColor="white"  Width="100%" Style="height: 545px;">
           
            <asp:ContentPlaceHolder ID="HeaderArea" runat="server">
                <asp:Panel ID="immsHeading" runat="server" Width="100%" BackColor="White" Height="70px">
                    <table style="width: 81%; height: 32px">
                     <tr>
                            <td style="height: 57px; width:169px; background-image:removed(images/topbg.jpg);">
                                <div style="float: left; height: 71px; margin-removed 10px; width: 1164px;">
                                <asp:Image ID="img1" runat="server" ImageUrl="~/images/logo1.png" Height="39px" Width="240px" ForeColor="White" />
                                    <!--<span id="lblHeader" style="font-size:Larger;font-weight:bold; color: white;">Strike</span>
                                            <span id="Label1" style="font-size:Larger;font-weight:bold; color: white;"> A Price </span>
                                            <span id="Label2" style="font-size:Larger;font-weight:bold; color: white;">.com </span>-->
                                   <asp:LinkButton ID="lblMyaccounts" runat="server" Font-Bold="True"

                                        Font-Italic="False" Font-Names="Arial" Font-Size="12px" Font-Underline="True"

                                        ForeColor="blue" Height="13px"  Text="My Accounts" Width="83px"> 
                                        <asp:LinkButton ID="lnkLogout" runat="server" OnClientClick="statwords('Go To Login Page')"

                                            Font-Size="Small" ForeColor="blue" Text="LogOut" Width="50px" Font-Names="TimesNewRoman" Font-Bold="True" OnClick="lnkLogout_Click"></div></td>
                                   <!-- <td align="right" style="height: 57px; background-image:removed(images/topbg.jpg);">
                                        <asp:Label ID="days_count" runat="server" Visible="False">
                                        <asp:Label ID="Label3" runat="server" Visible="False" Width="55px">
                                    </td>-->                                    
                        </tr>                    
                    </table>
            <table style=" text-align:center; width:100%; background-color: white; border:goldenrod 1px solid; height: 100px;">
            <tr>
                    <td style="width: 107%; height: 180px;">
                        <asp:ContentPlaceHolder ID="MainArea" runat="server">
                         <table style=" text-align:center; width:100%; background-color: white; height: 274px;">
       
       <tr>
           <td align="left" style="height: 60px; width: 62px;" valign="top">
        
                <asp:Menu ID="Menu1" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="12px"

                    ForeColor="White" Height="380px" Orientation="Vertical" Width="110px" BackColor="#EDA505" OnMenuItemClick="Menu1_MenuItemClick">
                    <staticmenustyle backcolor="#EDA505" />
                    <statichoverstyle forecolor="#FFFF80" />
                    <items>
                        <asp:MenuItem  Text="Registration" Value="NewRegistration">
                        
                        <asp:MenuItem  Text="View Details" Value="Registration">
                        <asp:MenuItem  Text="Change Password" Value="ChangePassword">
                        
                         <asp:MenuItem  Text="Update Client" Value="New Item">
                        
                        <asp:MenuItem  Text="Crawling" Value="New Item">
                       
                        <asp:MenuItem Text="Push to DB" Value="Transform  ExcelTable  To SqlserverTable ">
                    </items>
                </td>
        </tr>
        </table>
                    </td>
                  </tr>
             </table>
                        <br />
      </td>
                </tr>
               <tr>
                 <td align="center" valign="top" class="green" style="height: 57px; width: 80%;">
      <div style="height: 71px; margin-removed1px; width:100%; background-image:removed(images/topbg.jpg);">
                           <span class="style14" style="color:White;">Copyright © 2011
                                 <a style="color: White" title="StrikeAPrice" href="http://www.strikeaprice.com" target="_parent">StrikeAPrice</a></span></div></td>
                  </tr>
           </table>
    </form>
</body>

解决方案

you are not close all tages and style s make sure that all code of your master page and nothing will be in asp:ContentPlaceHolder tag.


check this is my master

<div class="wrap clearfix">
       <div style="text-align: left; background-color: #396184; width: 970px;">
           <table cellpadding="0" cellspacing="0">
               <tr>
                   <td>
                       <asp:Menu ID="mainMenu" runat="server" Orientation="Horizontal" BorderStyle="None"
                           ItemWrap="True" Width="400px" CssClass="padL15">
                           <StaticMenuStyle HorizontalPadding="1px" />
                           <StaticMenuItemStyle ForeColor="White" HorizontalPadding="1px" />
                           <DynamicMenuStyle BackColor="#e1e1e1" />
                           <DynamicMenuItemStyle ForeColor="#3f6080" />
                           <DynamicMenuStyle Width="150px" Height="70px" HorizontalPadding="15px" />
                           <Items>
                               <asp:MenuItem Text="ADMIN" Value="Admin">
                                   <asp:MenuItem Text="New User" Value="USER" NavigateUrl="~/RegistrationForm.Aspx"
                                       SeparatorImageUrl="~/images/seprator.jpg"></asp:MenuItem>

                           </Items>
                       </asp:Menu>
                   </td>

               </tr>
           </table>
       </div>
   </div>
   <div>
       <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">


       </asp:contentplaceholder>
   </div>


and one aspx.page which under the that master

<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
          <table>
                       //your code..........
                  </table>
        </asp:contentplaceholder>


这篇关于母版页不显示aspx页中的菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆