如何根据没有侧边栏的母版页将边栏添加到.net页面

时间:2010-04-28 21:49:01

标签: .net html css

我被告知我应该在此.net项目的一个页面上添加侧边栏,但母版页不包含侧边栏。如何仅将侧边栏添加到一个页面?

这是主模板的代码,任何人都可以建议或帮助我吗? 我会买一本书并阅读更多内容,但我必须在接下来的12个小时内完成这项工作。

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Public.master.cs" Inherits="Public" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%--<!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></title>

<%--<link href="favicon.ico" rel="Shortcut Icon" type="image/x-icon" />--%>
<link href="<%= Server.MapPath("~/css/main2.css") %>"  rel="stylesheet" type="text/css" media="all" />
<link href="<%= Server.MapPath("~/css/dropdown.css") %>"  media="screen" rel="stylesheet" type="text/css" />
<link href="<%= Server.MapPath("~/css/default.advanced.css") %>"  media="screen" rel="stylesheet" type="text/css" />
<link href="<%= Server.MapPath("~/css/vlightbox.css") %>"  rel="stylesheet" type="text/css" />
<link href="<%= Server.MapPath("~/css/visuallightbox.css") %>" rel="stylesheet" type="text/css" media="screen" />
<link href="<%= Server.MapPath("~/boxes.css") %>"rel="stylesheet" type="text/css" media="screen" />
<script src="<%= Server.MapPath("~/engine/js/jquery.min.js") %>" ype="text/javascript"></script>
<script src="<%= Server.MapPath("~/js/cufon-yui.js") %>" type="text/javascript"></script>
<script src="<%= Server.MapPath("~/js/AFB_400.font.js") %>"  type="text/javascript"></script>

<style type="text/css">
#vlightbox a#vlb {
    display:none
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js" ></script>

<script type="text/javascript">
    Cufon.replace('h2');
        </script>
<script type="text/javascript">
    Cufon.replace('h3');
        </script>
<script type="text/javascript">
    Cufon.replace('h5');
        </script>       
<!--[if  IE 8]>
    <style type="text/css">
        #footer {display:table;}
    </style>
<![endif]-->
<style>
ul#nav { width:100%; height:36px; display:block; background-color:#000; background-repeat:repeat-x; }
#wrapthatbanner {display:block; float:left; width:100%; height:529px; margin-left:-20px; margin-bottom:0px; }
</style>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'></script>
<script type="text/javascript">
    $(document).ready(function() {
        $("#footer").stickyFooter();
    });

    // sticky footer plugin
    (function($) {
        var footer;

        $.fn.extend({
            stickyFooter: function(options) {
                footer = this;

                positionFooter();

                $(window)
              .scroll(positionFooter)
              .resize(positionFooter);

                function positionFooter() {
                    var docHeight = $(document.body).height() - $("#sticky-footer-push").height();
                    if (docHeight < $(window).height()) {
                        var diff = $(window).height() - docHeight;
                        if (!$("#sticky-footer-push").length > 0) {
                            $(footer).before('<div id="sticky-footer-push"></div>');
                        }
                        $("#sticky-footer-push").height(diff);
                    }
                }
            }
        });
    })(jQuery);
    </script>

</head>

<body id="@@(categoria)@@">
<form id="form1" runat="server">
 <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" AsyncPostBackTimeout="900"></asp:ScriptManager>

<div id="container">  
   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <div id="header">
            <div id="headerlink">
         <table width="100%" border="0">
                  <tr>
                    <td height="77px;" width="67%">
                         <asp:ImageButton PostBackUrl="~/index.aspx" ImageUrl="~/images/Titulos/5.png" runat="server" alt="" name="screen_logo" width="257"  hspace="10" vspace="10"  border="0" id="screen_logo" title="" />
                    </td>
                    <td valign="top" align="right" width="33%">   
                    <table>
                        <tr>
                            <td>                        
                                <asp:Label ID="lblFullMessage" Visible="false" runat="server" Font-Size="X-Small" ForeColor="White" Text="Please enter the {0}, {1} and {2} characters from your password."></asp:Label>                                                                                                                                                                                 
                            </td>
                        </tr>
                        <tr valign="middle">
                            <td>
                               <img src="../images/login.jpg"</td>
                            <td valign="top">
                                <asp:TextBox runat="server" Height="16px" Font-Size="Small" ID="txtLogin" 
                                    Width="100px"></asp:TextBox>                
                                <asp:Button ID="btnLogin" Height="20px" Font-Size="X-Small" runat="server" Text="Go" OnClick="btnLogin_Click"  />     
                            </td>
                        </tr>
                        <tr>
                            <td>                        
                                <asp:Label ID="lblError" Visible="false" runat="server" Font-Size="X-Small" ForeColor="Red" Text="Error"></asp:Label>                                                                                                                                                                                 
                            </td>
                        </tr>
                    </table>  
                    </td>
                  </tr>
                </table>   
            </div>  
        </div>     
        </ContentTemplate>
    </asp:UpdatePanel>                    

  <ul id="nav" class="dropdown dropdown-horizontal">
    <li><asp:HyperLink NavigateUrl="~/index.aspx" CssClass="dir" runat="server" ID="lnk1">Home</asp:HyperLink></li>
    <li><asp:HyperLink NavigateUrl="~/PublicSide/link.aspx" CssClass="dir" runat="server" ID="lnk3">link</asp:HyperLink></li>
    <li><asp:HyperLink NavigateUrl="~/PublicSide/link.aspx" CssClass="dir" runat="server" ID="lnk4">link</asp:HyperLink></li>
    <li><asp:HyperLink NavigateUrl="~/PublicSide/link.aspx" CssClass="dir" runat="server" ID="lnk7">link</asp:HyperLink></li>
    <li><asp:HyperLink NavigateUrl="~/PublicSide/link.aspx" CssClass="dir" runat="server" ID="lnk5">link</asp:HyperLink></li>
    <li><asp:HyperLink NavigateUrl="~/PublicSide/link.aspx" CssClass="dir" runat="server" ID="lnk2">link</asp:HyperLink></li>
    <li><asp:HyperLink NavigateUrl="~/PublicSide/link.aspx" CssClass="dir" runat="server" ID="lnk6">link</asp:HyperLink></li>    
  </ul>
  <div id="wmfg"> </div>
  <div id="content"><asp:ContentPlaceHolder ID="Content1" runat="server"> </asp:ContentPlaceHolder></div>

  <div id="footer">Footer</div>
</div>
</form>
</body>

</html>

1 个答案:

答案 0 :(得分:4)

这可能有点过于简单:在向项目添加新页面时,选择Web表单而不是Web内容表单。这样,您可以在不使用母版页的情况下粘贴上述标记。或者,使用您需要的侧边栏创建第二个母版页,并添加使用该第二个母版页的新Web内容表单。

HTH