在MasterPage对象页面对象后面的aspx页面对象?

时间:2015-11-17 04:31:12

标签: c# html css asp.net master-pages

我的MasterPage文件中有一个下拉菜单,它在aspx页面上删除对象后面的。我已经使用CSS将z-index为100应用于masterPage菜单,将z-index为-1应用于aspx页面中的标记。我添加了位置:亲戚;在每个CSS中。这不起作用。我突然觉得这甚至不可能做到?但肯定其他人在他们的masterPage文件中有一个下拉菜单,它可以正常工作(不会被下面页面中的项隐藏)。有谁知道我想做什么是可能的。如果是这样,有没有人对我可能做错的事情有任何想法?

MasterPage代码:

</head>

 <body class="innermainbg">
  <form id="Form1" runat="server">

   <div> 
    <div class="header">        
        <div id="nav" class="clear hideSkiplink nav" >
            <asp:Menu ID="NavigationMenu" runat="server" Orientation="Horizontal" CssClass="menu" >            
                <staticmenuitemstyle horizontalpadding="20"/>                    

                <Items>
                    <asp:MenuItem Text="Search" NavigateUrl="~/Default.aspx"  Value="Item1" >                            
                        <asp:MenuItem Text="Search By Age" NavigateUrl="~/SearchByAge.aspx" Value="Sub Item2"></asp:MenuItem>
                        <asp:MenuItem Text="Search By Price" NavigateUrl="~/SearchByPrice.aspx" Value="Sub Item3"></asp:MenuItem>
                        <asp:MenuItem Text="Search By Date" NavigateUrl="~/SearchByDate.aspx" Value="Sub Item2"></asp:MenuItem>
                        <asp:MenuItem Text="Search By Type" NavigateUrl="~/SearchByType.aspx" Value="Sub Item3"></asp:MenuItem>
                        <asp:MenuItem Text="Advanced Search" NavigateUrl="~/AdvSearch.aspx" Value="Sub Item1"></asp:MenuItem>
                    </asp:MenuItem>
                    <asp:MenuItem Text="Get Listed Free!" NavigateUrl="~/GetListed.aspx" Value="Item2">                            
                    </asp:MenuItem>

                    <asp:MenuItem Text="Advertise" NavigateUrl="~/Advertise.aspx" Value="Item2">
                        <asp:MenuItem Text="Links" NavigateUrl="~/Links.aspx" Value="Sub Item1"></asp:MenuItem>
                    </asp:MenuItem>
                    <asp:MenuItem Text="About" NavigateUrl="~/About.aspx" Value="Item2">
                        <asp:MenuItem Text="Terms" NavigateUrl="~/Terms.aspx" Value="Sub Item1"></asp:MenuItem>
                        </asp:MenuItem>
                    <asp:MenuItem Text="Contact" NavigateUrl="~/Contact.aspx" Value="Item2">
                        <asp:MenuItem Text="Help" NavigateUrl="~/Help.aspx" Value="Sub Item1"></asp:MenuItem>
                        <asp:MenuItem Text="FAQs" NavigateUrl="~/FAQs.aspx" Value="Sub Item2"></asp:MenuItem>
                        </asp:MenuItem>
                </Items>
            </asp:Menu>                
        </div>            
    </div>

    <div class="main">
        <asp:ContentPlaceHolder ID="MainContent" runat="server"/>            
    </div>        
    <div class="clear"></div>
  </div>
  <div></div>
  <div class="footerholder">
     <div id="footerContent" class="footer">
        © 2014 Professional Expressions Inc. ClassesnWorkshops.com is a registered Trademark of Professional Expressions Inc. All rights reserved.
     </div>
  </div>
 </form>         

</body>

</html>

parial CSS代码:     。背部     {        位置:相对;        z-index:-1;     }

div.menu
{
    padding: 0px 0px 0px 0px;
    float: right;
    width: 100%;      
    position: relative;
    z-index: 100; 
}

ClassResults.aspx页面代码:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" 
CodeBehind="ClassResults.aspx.cs" Inherits="ClassesnWorkshops.ClassResults" %>

                                                                                            邮政编码:                                    距离:                                                                              lblSearchWords            
           
             

<div align="left" style="background-color: transparent; height: 250px; float:left; width:100%; background-repeat:no-repeat; background-position: 50% 50%;">
    <div style="width:13%; float:left; display:inline;" class="rtPad10px">
       <asp:Image ID="spacer1" runat="server" ImageUrl="~/Images/spacer_130x18px.png" /> 
    </div>
    <div style="width:69%; height:100%; float:left; display:inline;">           
       <br />                                                         
            <asp:Label ID="lblTotalItemCount" runat="server" Enabled="False"></asp:Label>
            &nbsp; &nbsp; &nbsp;                 
            <asp:Label ID="lblCurrentPage" runat="server" Enabled="False"></asp:Label>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

        <asp:Label ID="lblSort" runat="server" Enabled="False" >Sort:</asp:Label> &nbsp;
        <asp:DropDownList ID="ddlSort" runat="server" AutoPostBack="True"
            onselectedindexchanged="ddlSort_SelectedIndexChanged" ViewStateMode="Enabled" EnableViewState="true" > 
            <asp:ListItem Value="Title">Class Title</asp:ListItem>
            <asp:ListItem Value="schoolName">School Name</asp:ListItem>
            <asp:ListItem Value="ClassSubject">Subject</asp:ListItem>
            <asp:ListItem Value="Miles">Distance</asp:ListItem>
            <asp:ListItem Value="lowestCost">Cost (low to high)</asp:ListItem>
            <asp:ListItem Value="dateStart">Start Date</asp:ListItem>
        </asp:DropDownList>

        <asp:Button ID="btnSort" runat="server" Text="Sort" onclick="btnSort_Click" />
        &nbsp; &nbsp; &nbsp;
        <asp:Label ID="lblItemsPerPage" runat="server" Enabled="False">Items per page:</asp:Label>&nbsp;
                      <asp:DropDownList ID="ddlPageSize" runat="server"  AutoPostBack="True"  
                           ViewStateMode="Enabled" EnableViewState="true" onselectedindexchanged="ddlPageSize_SelectedIndexChanged">
                      <asp:ListItem Text="1" Selected="True" Value="1"></asp:ListItem>
                      <asp:ListItem Text="10" Value="10"></asp:ListItem>
                      <asp:ListItem Text="20" Value="20"></asp:ListItem>
                      <asp:ListItem Text="50" Value="50"></asp:ListItem>
                      <asp:ListItem Text="100" Value="100"></asp:ListItem>
                      <asp:ListItem Text="200" Value="200"></asp:ListItem>
                  </asp:DropDownList>
        <br />            
        <br />
        <asp:Label ID="lblValidationZip" runat="server" Enabled="False" ForeColor="Red" Text="A valid 5 digit zipCode is required."></asp:Label><br />
            <asp:Label ID="lblMessage" runat="server" Text="lblMessage"></asp:Label>
            <br />
            <asp:Label ID="lblMsgTooManyOrTooFew" runat="server" Text=""></asp:Label>
        <br /> 
        <asp:Repeater ID="rptClasses" runat="server" >
           <ItemTemplate>    
              <asp:Table runat="server" ID="tblClassesReturned" style="width:99%" >                    
                <asp:TableRow ID="TableRow1" runat="server">
                    <asp:TableCell style="width:15%; text-align:left;">
                       <img src='C:\Users\Teresa\My Webs\ClassesnWorkshops\ClassesnWorkshops\images\logos\<%# DataBinder.Eval(Container.DataItem, "logoID") %>.jpg' align="left" alt="School Logo">
                    </asp:TableCell>
                    <asp:TableCell ID="TableCell1"  runat="server" style="width:41%; float:left; text-align:left;">
                        Subject: <%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "ClassSubject")) %><br />
                        <b>Title: <asp:HyperLink ID="hlClass" NavigateUrl='<%#"~/Class.aspx?classID=" + DataBinder.Eval(Container.DataItem, "ClassID")%>' Text=<%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "ClassTitle")) %> Target="_blank" runat="server" /> </b><br></br>
                           <asp:Label ID="lblCostRange" ToolTip="Lowest price usually indicates residence, member or early bird cost. Highest price usually indicates non-residence, non-member or non-earlybird cost." runat="server">
                           Cost Range: <%# String.Format("{0:c}", DataBinder.Eval(Container.DataItem, "lowestCost")) %> - <%# String.Format("{0:c}", DataBinder.Eval(Container.DataItem, "highestCost")) %><br />  
                           </asp:Label> 
                                <asp:Label ID="lblCostNote" runat="server" font-size="8pt">
                                &nbsp;  * Additional Fees or Discounts May Apply. 
                                </asp:Label> 
                                <br />                         
                                <asp:Label ID="lblClassSeason" ToolTip="Season that this class is held." runat="server">
                                <%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "ClassSeason")) %> &nbsp; &nbsp;
                                </asp:Label>
                                <asp:Label ID="lblClassYear" ToolTip="Year that this class is held" runat="server"> 
                                <%# String.Format("{0:0}", DataBinder.Eval(Container.DataItem, "ClassYear")) %> &nbsp; &nbsp;
                                </asp:Label>
                                <asp:Label ID="ClassDays" ToolTip="Days of the Week this class is held: M=Monday, T=Tuesday, W=Wednesday, H=Thursday, F=Friday, A=Saturday, S=Sunday" runat="server">
                                <%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "ClassDays")) %>  &nbsp; &nbsp;
                                </asp:Label>
                                <%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "ClassStartTime")) %><br />
                            </asp:TableCell><asp:TableCell ID="TableCell2" runat="server" style="width:44%; float:left; text-align:left;">              
                               <b><asp:HyperLink ID="HyperLink1" NavigateUrl="~/School.aspx" Text=<%# DataBinder.Eval(Container.DataItem, "schoolName") %> Target="_blank" runat="server" /> </b>
                                -                                       
                                <%# String.Format("{0:0.0}", DataBinder.Eval(Container.DataItem, "Miles")) %> miles away
                            <br />
                            Campus: <%# DataBinder.Eval(Container.DataItem, "campus") %><br />
                            <%# DataBinder.Eval(Container.DataItem, "street") %> &nbsp;
                            <%# DataBinder.Eval(Container.DataItem, "city") %>, &nbsp;
                            <%# DataBinder.Eval(Container.DataItem, "state") %> &nbsp;
                            <%# DataBinder.Eval(Container.DataItem, "zip") %><br />
                            <asp:HyperLink ID="hlSchool" NavigateUrl=<%# DataBinder.Eval(Container.DataItem, "web") %> Text=<%# DataBinder.Eval(Container.DataItem, "web") %> Target="_blank" runat="server" /> <br>
                            <%-- %><br><%# DataBinder.Eval(Container.DataItem, "longDesc")  --%>

                        </asp:TableCell></asp:TableRow></asp:Table><br /><hr>
                 <br />
            </ItemTemplate>
        </asp:Repeater>            


        <br />
        <asp:LinkButton ID="LnkFirst" runat="server" onclick="LnkFirst_Click">First</asp:LinkButton>&nbsp; &nbsp; <asp:LinkButton ID="LnkPrevious" runat="server" onclick="LnkPrevious_Click">Previous</asp:LinkButton>&nbsp; &nbsp; <asp:Repeater ID="rptPages" runat="server">                   
               <ItemTemplate>
                  <asp:LinkButton ID="btnPage" CommandName="Page" CommandArgument="<%# Container.DataItem %>" runat="server">   
                     <%# Container.DataItem %> 
                  </asp:LinkButton>&nbsp; &nbsp;</ItemTemplate></asp:Repeater>&nbsp; &nbsp; <asp:LinkButton ID="LnkNext" runat="server" onclick="LnkNext_Click">Next</asp:LinkButton>&nbsp; &nbsp; <asp:LinkButton ID="LnkLast" runat="server" onclick="LnkLast_Click">Last</asp:LinkButton><br />
            <br />
            <%-- 
            <asp:Label ID="lblValidationZip" runat="server" Enabled="False" ForeColor="Red" Text="A valid 5 digit zipCode is required."></asp:Label><br />
            <asp:Label ID="lblMessage" runat="server" Text="lblMessage"></asp:Label>
            <br />
            <asp:Label ID="lblMsgTooManyOrTooFew" runat="server" Text=""></asp:Label>
            --%>
            </div><div style="width:17%; float:left; display:inline;" ><asp:Image 
            ID="spacer2" runat="server" ImageUrl="~/Images/spacer_170x18px.png" /></div></div></asp:Content>

1 个答案:

答案 0 :(得分:0)

使用浏览器的inspect element工具检查你的css和html结构。在浏览器中打开网站,右键单击它,在菜单底部你将检查元素选项。 这将为您提供完整的HTML和您的CSS的视图。你可以编辑css,它会让你在页面上即时更改。