net网上购物车课程设计Word格式.docx
- 文档编号:17184499
- 上传时间:2022-11-28
- 格式:DOCX
- 页数:25
- 大小:570.99KB
net网上购物车课程设计Word格式.docx
《net网上购物车课程设计Word格式.docx》由会员分享,可在线阅读,更多相关《net网上购物车课程设计Word格式.docx(25页珍藏版)》请在冰豆网上搜索。
C#"
AutoEventWireup="
true"
CodeFile="
WebUserControl.ascx.cs"
Inherits="
WebUserControl"
%>
divstyle="
text-align:
center"
>
<
tablestyle="
width:
20cm;
height:
3cm"
tr>
tdalign="
center"
rowspan="
3"
style="
7cm;
asp:
ImageID="
Image1"
runat="
server"
ImageUrl="
~/image/r1.jpg"
/>
/td>
tdstyle="
13cm;
1cm"
marquee>
欢迎来到网络食品店<
/marquee>
/tr>
LabelID="
Label1"
Text="
美食在线"
/asp:
Label>
&
nbsp;
HyperLinkID="
HyperLink1"
NavigateUrl="
~/主页.aspx"
主页<
HyperLink>
HyperLink2"
~/购物车.aspx"
购物车<
HyperLink3"
~/结账.aspx"
结账<
HyperLink4"
~/订单.aspx"
订单<
ButtonID="
Button1"
查询"
:
TextBoxID="
TextBox1"
Width="
49px"
TextBox>
Label2"
/table>
/div>
用户控件后台文件:
usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
publicpartialclassWebUserControl:
System.Web.UI.UserControl
{
protectedvoidPage_Load(objectsender,EventArgse)
{
DateTimed=DateTime.Now;
Label2.Text=d.ToLongDateString()+d.ToLongTimeString();
}
}
4.1.2主控页的设计
主控页源代码:
%@MasterLanguage="
MasterPage.master.cs"
MasterPage"
%@RegisterSrc="
WebUserControl.ascx"
TagName="
TagPrefix="
uc1"
!
DOCTYPEhtmlPUBLIC"
-//W3C//DTDXHTML1.0Transitional//EN"
"
http:
//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
htmlxmlns="
//www.w3.org/1999/xhtml"
>
headrunat="
title>
无标题页<
/title>
/head>
body>
formid="
form1"
div>
br/>
15cm;
background-image:
url(image/h.jpg);
"
tdcolspan="
2"
uc1:
WebUserControlID="
WebUserControl1"
10cm;
10cm"
GridViewID="
GridView1"
AutoGenerateColumns="
False"
DataKeyNames="
CategoryID"
DataSourceID="
SqlDataSource1"
Columns>
HyperLinkFieldDataNavigateUrlFields="
DataNavigateUrlFormatString="
商品.aspx?
CategoryID={0}"
HeaderText="
选择"
商品"
BoundFieldDataField="
类型ID"
InsertVisible="
ReadOnly="
True"
SortExpression="
CategoryName"
类型名"
/Columns>
GridView>
SqlDataSourceID="
ConnectionString="
%$ConnectionStrings:
NorthwindConnectionString%>
SelectCommand="
SELECT[CategoryName],[CategoryID]FROM[Categories]"
SqlDataSource>
contentplaceholderid="
ContentPlaceHolder1"
contentplaceholder>
2cm"
Copyright&
copy;
2012网络食品在线
/form>
/body>
/html>
4.2内容页的设计
4.2.1主页的设计
主页源代码:
%@PageLanguage="
MasterPageFile="
~/MasterPage.master"
主页.aspx.cs"
Default2"
Title="
UntitledPage"
ContentID="
Content1"
ContentPlaceHolderID="
Runat="
Server"
350px;
154px"
100px"
欢&
迎<
选&
购<
Content>
4.2.2商品网页的设计
商品页源代码:
商品.aspx.cs"
ProductID"
OnRowCommand="
GridView1_RowCommand"
ButtonFieldCommandName="
select"
选购"
产品ID"
ProductName"
产品名"
QuantityPerUnit"
单元数量"
UnitPrice"
单价"
SELECT[ProductID],[ProductName],[CategoryID],[QuantityPerUnit],[UnitPrice]FROM[Products]WHERE([CategoryID]=@CategoryID)"
SelectParameters>
QueryStringParameterName="
QueryStringField="
Type="
Int32"
/SelectParameters>
商品页后台文件:
publicpartialclassDefault2:
System.Web.UI.Page
protectedvoidGridView1_RowCommand(objectsender,GridViewCommandEventArgse)
System.Data.DataTableCart=newSystem.Data.DataTable();
if(e.CommandName=="
)
if(Session["
ShoppingCart"
]==null)
Cart.Columns.Add("
商品编号"
typeof(int));
商品名称"
typeof(string));
单元含量"
typeof(double));
Session["
]=Cart;
Cart=(System.Data.DataTable)Session["
];
intindex=Convert.ToInt32(e.CommandArgument);
GridViewRowrow=GridView1.Rows[index];
stringbhText=row.Cells[1].Text;
stringmcText=row.Cells[2].Text;
stringdyText=row.Cells[4].Text;
stringdjText=row.Cells[5].Text;
intbh=int.Parse(bhText);
doubledj=double.Parse(djText);
System.Data.DataRowrr=Cart.NewRow();
rr["
]=bh;
]=mcText;
]=dyText;
]=dj;
Cart.Rows.Add(rr);
4.2.3购物车网页的设计
购物车页源代码:
购物车.aspx.cs"
客户标志:
55px"
RequiredFieldValidatorID="
RequiredFieldValidator1"
ControlToValidate="
ErrorMessage="
请输入客户标志"
RequiredFieldValidator>
buy"
购买"
确认"
TemplateFieldHeaderText="
数量"
ItemTemplate>
TextBox2"
%#1%>
57px"
/ItemTemplate>
TemplateField>
购物车页后台文件:
if(!
IsPostBack)
GridView1.DataSource=Session["
DataBind();
ShoppingCart2"
订购数量"
折扣"
合计"
if(TextBox1.Text=="
Validate();
else
khbz"
]=TextBox1.Text;
intindex
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- net 网上 购物 课程设计
![提示](https://static.bdocx.com/images/bang_tan.gif)