http://www.binaryintellect.net/articles/displayarticle.aspx?id=7
E-Commerce Starter Kit 是一个电子商务系统,采用最新的asp.net2.0技术.
自己打算一边学习一边分析
1.母版
1.1顶部logo信息,登陆信息,页尾信息
logo图片信息和尾部信息保存在web.config里面
转到母板后台代码,可以看到
1protected void Page_Load(object sender, EventArgs e)
2 {
3 //页标题,logo信息,两个联系信息
4 Page.Title = ConfigurationManager.AppSettings["pagetitle"];
5 HyperLink1.ImageUrl = "~/" + ConfigurationManager.AppSettings["imagefolder"] + "/" + ConfigurationManager.AppSettings["sitelogo"];
6 lnkAds.NavigateUrl = "mailto:" + ConfigurationManager.AppSettings["advertiseemail"];
7 lnkWebmaster.NavigateUrl = "mailto:" + ConfigurationManager.AppSettings["webmasteremail"];
8 }
2 {
3 //页标题,logo信息,两个联系信息
4 Page.Title = ConfigurationManager.AppSettings["pagetitle"];
5 HyperLink1.ImageUrl = "~/" + ConfigurationManager.AppSettings["imagefolder"] + "/" + ConfigurationManager.AppSettings["sitelogo"];
6 lnkAds.NavigateUrl = "mailto:" + ConfigurationManager.AppSettings["advertiseemail"];
7 lnkWebmaster.NavigateUrl = "mailto:" + ConfigurationManager.AppSettings["webmasteremail"];
8 }
接着看web.config自定义配置信息
1<appSettings>
2 <add key="pagetitle" value="E-Commerce Starter Kit (Ver.1.0)"></add>
3 <add key="sitelogo" value="logo.gif"></add>
4 <add key="imagefolder" value="images"></add>
5 <add key="webmasteremail" value="webmaster@somesite.com"></add>
6 <add key="advertiseemail" value="sales@somesite.com"></add>
7 </appSettings>
2 <add key="pagetitle" value="E-Commerce Starter Kit (Ver.1.0)"></add>
3 <add key="sitelogo" value="logo.gif"></add>
4 <add key="imagefolder" value="images"></add>
5 <add key="webmasteremail" value="webmaster@somesite.com"></add>
6 <add key="advertiseemail" value="sales@somesite.com"></add>
7 </appSettings>
登陆信息处用了三个用户控件
LoginName 控件将显示该用户的登录名,用户登陆后显示欢迎信息
当用户登录后显示购物车和购物历史,否则不显示
LoginStatus 控件为没有通过身份验证的用户显示登录链接,为通过身份验证的用户显示注销链接.
1<asp:LoginName ID="LoginName1" Runat="server" SkinID="FormLabel" FormatString="Welcome {0} !" />
2
3 <asp:LoginView ID="LoginView1" runat="server">
4 <LoggedInTemplate>
5 <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/shoppingcart.aspx">View my Cart</asp:HyperLink>
6 |
7 <asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="~/OrderHistory.aspx">Order History</asp:HyperLink>
8 |
9 </LoggedInTemplate>
10 </asp:LoginView>
11 <asp:LoginStatus ID="LoginStatus1" Runat="server" LogoutPageUrl="~/default.aspx" LogoutAction="Redirect" />
2
3 <asp:LoginView ID="LoginView1" runat="server">
4 <LoggedInTemplate>
5 <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/shoppingcart.aspx">View my Cart</asp:HyperLink>
6 |
7 <asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="~/OrderHistory.aspx">Order History</asp:HyperLink>
8 |
9 </LoggedInTemplate>
10 </asp:LoginView>
11 <asp:LoginStatus ID="LoginStatus1" Runat="server" LogoutPageUrl="~/default.aspx" LogoutAction="Redirect" />
2. 搜索模块
3.产品分类模块
4.热销产品模块
中间模块主要用于产品信息及其他内容
搜索模块,产品分类模块,热销产品模块分别作为单独的用户控件
接着我们继续分析其他页面