⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 site.master

📁 ASP.NET2.0(C#篇)经典教程的源码...本源码很好的实现了购物车....编码规范和类的设计具有很好的借鉴性!
💻 MASTER
字号:
<%@ master Language="C#" debug="true" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Configuration" %>

<script runat="server">
    
  private bool realMode;

  void Page_Load(object sender, System.EventArgs e)
  {
    if (SiteMap.CurrentNode == null)
    {
      ViewSourceButton.HRef = "SourceViewer/SrcView.aspx?file=" + new System.IO.FileInfo(Request.PhysicalPath).Name;
    }
    else
    {
      PageTitle.Text = SiteMap.CurrentNode.Title;
      ViewSourceButton.HRef = "SourceViewer/SrcView.aspx?file=" + SiteMap.CurrentNode.Url;
    }

    // hide the code download / source view section if running in real mode
    realMode = (ConfigurationManager.AppSettings["mode"] == "Real");
    if (realMode)
    {
      code.Visible = false;
      login1.HelpPageUrl = "";
      login1.HelpPageText = "";
    }

  }

  // Databinding for individual menu items is done to remove certain items from the menu
  // This allows us to have the items in the sitemap and for them to partake in the 
  // siteMapPath control, but not to appear in the menu. 
  protected void MyMenu_MenuItemDataBound(object sender, System.Web.UI.WebControls.MenuEventArgs e)
  {
    string text = e.Item.Text;

    if (text == "Checkout" || text == "Shop Item" || text == "Shopping Cart")
      e.Item.Parent.ChildItems.Remove(e.Item);
  }
    

</script>

<!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 id="PageHead" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Language" content="en-uk" />

    <title>Wrox United</title>
    <link rel="stylesheet" type="text/css" href="site.css" runat="server" />
    <link rel="Alternate" type="text/css" href="siteHighContrast.css" runat="server" />
</head>

<body>
    <form id="mainForm" runat="server">
    <div>
        <div id="header">
            <div id="logo"></div>
            <h1>Wrox United</h1>

            <div id="code" class="code" runat="server">
                <a href="WroxUnited.zip" title="Download the code for this site">Download Code</a><br />
                <a id="ViewSourceButton" runat="server" target="_blank"
                    title="View page source in a new window">View Page Source</a>
            </div>
        </div>
        
        
        <div id="sidebar">
            <h3>Navigation</h3>
            <asp:sitemapdatasource id="siteData" runat="server" />
            <div id="nav">
                <asp:menu id="MyMenu" runat="server" datasourceid="siteData"
                    orientation="Vertical"
                    staticdisplaylevels="2" StaticSubMenuIndent="0"
                    disappearafter="200"
                    AccessKey="m"
                    OnMenuItemDataBound="MyMenu_MenuItemDataBound"
                    EnableViewState="false"
                    >
                    <DynamicMenuStyle CssClass="dynamicMenu" />
                    <DynamicMenuItemStyle CssClass="dynamicMenuItem" />
               </asp:menu>
            </div>

            <div>
                <asp:Login ID="login1" runat="server" CssClass="login" 
                    TextLayout="TextOnTop" VisibleWhenLoggedIn="False"
                    HelpPageUrl="~/logindetails.aspx" HelpPageText="help"
                    AccessKey="l">
                    <TitleTextStyle CssClass="title" />
                </asp:Login>
                <br clear="all" />
            </div>

            <asp:LoginView ID="LoginView1" Runat="server">
                <LoggedInTemplate>
                    <div class="loggedinout">
                        <div class="title"><asp:LoginName ID="loginName1" Runat="server" /></div>
                        <a href="FanClub.aspx">Modify Account</a><br />
                        <a href="ShoppingCart.aspx">Shopping Cart</a>
                        <br />
                        <asp:LoginStatus id="LoginStatus1" runat="server" />
                    </div>
                </LoggedInTemplate>
                <AnonymousTemplate>
                    <div class="loggedinout">
                        <a href="ShoppingCart.aspx">Shopping Cart</a>
                    </div>
                </AnonymousTemplate>
            </asp:LoginView>
        </div>
        
        
        <div id="content">

            <h2><asp:Label ID="PageTitle" runat="server" /></h2>
            
            <div class="itemContent">
                <asp:contentplaceholder id="mainContent" runat="server" />
            </div>
            
            <div id="breadcrumbs">
                <asp:sitemappath style="float:left" id="crumbs" runat="server"  />
            </div>
        </div>

  
        <div id="footer">
	        <p class="left">All content copyright &copy; Wrox Press and its subsidiaries 2004.</p>
	        <p class="right">Website designed by <a href="http://www.frogboxdesign.co.uk/" title="croak">Frog Box Design</a></p>
        </div>
    </div>
    </form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -