基于 - - C#.NET - 的 - “网上书店” - 设计与实现(7)

2019-04-23 09:54

第四章 网站设计的实现

其中涉及到的header.ascx的前台代码如下:

<%@ Control Language=\Inherits=\

codebase=\,0\

type=\

26

第四章 网站设计的实现

※※※※※※※※

涉及到的版权控件banquan.ascx的前台代码如下: .

<%@ Control Language=\Inherits=\

※站长联系地址:河南开封黄河水院信息系 邮政编码:475003 ※站务电话:15937862109(广告合作)

※联系Email:

 ※Copyright (C) E梦书斋版权所有 2008, All Rights Reserved※

27

第四章 网站设计的实现

下面展示LookBook.aspx的后台代码,至于涉及到的Header.ascx和Banquan.ascx的后台代码,不再展示:

using System;

using System.Data;

using System.Configuration; using System.Collections; using System.Web;

using System.Web.Security; using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient;

public partial class LookBook : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) {

if (!this.IsPostBack)

{ this.bindbookinfo(); }

if (Session[\ { this.btn_to_logon.Visible = true;

labname.Text = \您还未登录\ this.btnexit.Visible = false; } else

{ this.btn_to_logon.Visible = false; //显示登录者的用户名

labname.Text = \欢迎您: \

Session[\

} }

public object bindbookinfo() {

SqlConnection con = DBAccess.createsqlcon(); con.Open();

SqlDataAdapter sda = new SqlDataAdapter();

sda.SelectCommand = new SqlCommand(\

28

第四章 网站设计的实现

DataSet ds = new DataSet(); sda.Fill(ds, \

this.GvListBook.DataSource = ds.Tables[\ this.GvListBook.DataBind(); return ds; }

protected void GvListBook_RowDataBound(object sender, GridViewRowEventArgs e) { //修改选中行的背景颜色

if (e.Row.RowType == DataControlRowType.DataRow) {

e.Row.Attributes.Add(\

\

e.Row.Attributes.Add(\ }

}

protected void btnexit_Click(object sender, EventArgs e) { //清空session并修改相应的导航按钮的可见性。 Session[\ labname.Text = \请您登录!\ btn_to_logon.Visible=true; btnexit.Visible = false; }

protected void btn_to_logon_Click(object sender, EventArgs e) {

Response.Redirect(\ }

protected void GvListBook_PageIndexChanging(object sender, GridViewPageEventArgs e)

{

this.GvListBook.PageIndex = e.NewPageIndex; this.GvListBook.DataSource = bindbookinfo(); this.GvListBook.DataBind(); } }

4.3 本章小结

本章主要简单介绍网站的首页,按照方便用户的原则试用了浏览书籍的页面。各个版块的管理、各个页面之间的连接跳转等,均采用了导航条来实现。为了能够清楚地表达所要描述的问题,列出了Lookbook.aspx页面的前台、后台代码。

29

第四章 网站设计的实现

同时也把涉及到的用户控件的代码清单也部分的列了出来。

30


基于 - - C#.NET - 的 - “网上书店” - 设计与实现(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2017年中国卷烟纸市场行情动态与投资战略分析(目录) - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: