Asp.net源码专业站
首页->新知实践->JaneLee简单购物车源码>>account.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:JaneLee简单购物车源码
当前文件:文件类型 JaneLeeShopCart/account.aspx.cs[3K,2009-6-12 11:45:29]打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11 12public partial class account : System.Web.UI.Page 13{ 14 protected void Page_Load(object sender, EventArgs e) 15 { 16 if (!IsPostBack) 17 { 18 if(Session["khbz"]!=null) 19 TextBox1.Text=Session["khbz"].ToString(); 20 GridView1.DataSource = Session["shoppingcart2"]; 21 GridView1.DataBind(); 22 } 23 } 24 protected void Button1_Click(object sender, EventArgs e) 25 { 26 double sum = 0.0; 27 for (int i = 0; i < GridView1.Rows.Count; i++) 28 { 29 CheckBox cc = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox1"); 30 if (cc.Checked) 31 { 32 sum = sum + (double.Parse(GridView1.Rows[i].Cells[6].Text)); 33 } 34 } 35 TextBox2.Text = sum.ToString(); 36 } 37 protected void Button2_Click(object sender, EventArgs e) 38 { 39 for (int i = 0; i < GridView1.Rows.Count; i++) 40 { 41 CheckBox cc = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox1"); 42 if (cc.Checked) 43 { 44 SqlDataSource1.InsertParameters.Clear(); 45 if (Session["khbz"] != null) 46 //Response.Write(Session["khbz"]); 47 SqlDataSource1.InsertParameters.Add("Param1", Session["khbz"].ToString()); 48 SqlDataSource1.InsertParameters.Add("Param2", GridView1.Rows[i].Cells[1].Text); 49 SqlDataSource1.InsertParameters.Add("Param3", GridView1.Rows[i].Cells[2].Text); 50 SqlDataSource1.InsertParameters.Add("Param4", GridView1.Rows[i].Cells[3].Text); 51 SqlDataSource1.InsertParameters.Add("Param5", GridView1.Rows[i].Cells[4].Text); 52 SqlDataSource1.InsertParameters.Add("Param6", GridView1.Rows[i].Cells[5].Text); 53 SqlDataSource1.InsertParameters.Add("Param7", DateTime.Today.ToShortDateString()); 54 //if (Session["khbz"] != null) 55 // SqlDataSource1.InsertParameters[0].DefaultValue = Session["khbz"].ToString(); 56 //SqlDataSource1.InsertParameters[1].DefaultValue = GridView1.Rows[i].Cells[1].Text; 57 //SqlDataSource1.InsertParameters[2].DefaultValue = GridView1.Rows[i].Cells[2].Text; 58 //SqlDataSource1.InsertParameters[3].DefaultValue = GridView1.Rows[i].Cells[3].Text; 59 //SqlDataSource1.InsertParameters[4].DefaultValue = GridView1.Rows[i].Cells[4].Text; 60 //SqlDataSource1.InsertParameters[5].DefaultValue = GridView1.Rows[i].Cells[5].Text; 61 //SqlDataSource1.InsertParameters[6].DefaultValue = DateTime.Now.ToString(); 62 Session["ccsj"] = DateTime.Today.ToShortDateString(); 63 SqlDataSource1.Insert(); 64 65 } 66 } 67 Session["shoppingcart"] = ""; 68 Session["shoppingcart2"] = ""; 69 Response.Redirect("ordering.aspx"); 70 } 71} 72
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:JaneLee简单购物车源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146