老哥们就是我想实现一个购物车中 选中某些商品然后点击按钮,跳转到下一个订单界面的时候,能够把这些选中的商品带过来。
我想是这样实现,在数据库中增加一个state属性,类型为int 值为0 1,(0代表未选中,1代表选中),那么我在购物车界面,选中了某些商品,然后我点击确定按钮,将所有选中的商品的state更新update为1,然后到下一个界面列出该用户且选中的商品进行下单,但是我这块的数据库显示是用的循环来显示的,就是我不知道该如何让系统知道 我点击选中,选中的是这一行的这一个商品,或者说我选中之后我应该如何获取这个商品的id然后去更改他的状态
因为你是循环出来的数据,从后台写的话,你如何让后台的循环与前台同步呢,或者你如何获取你点的checkbox所在行的商品id呢(至于为什么要获取商品的id,数据库中的SQL语句、你想更新他的状态,你必须知道是哪一个商品id
<%@ Import Namespace="Website.Model" %>
<%@ Import Namespace="Website.DAL" %>
<!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 runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 86px;
}
.style2
{
height: 33px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table width="1000" align="center" border="0">
<tr><td align="center">
<table width="100%" align="center" border="1">
<tr align="center"><td class="style1">选择</td><td>编号</td><td>商品</td><td>价格</td><td>数量</td><td>
选中状态</td></tr>
<% Website.Model.Customer customer = new Website.Model.Customer();
customer = (Website.Model.Customer)Website.DAL.SessionHelper.GetSession("customer");
List<FShopping> list = FShoppingDAL.list(1);//括号内的1为指定的顾客id=1,即列出id为1的顾客的购物车
%>
<% for (int i = 0; i < list.Count; i++)
{ Website.Model.Flower flowername = Website.DAL.FlowerDAL.GetById(list[i].f_id);%>
<tr align="center">
<td class="style1">
<asp:CheckBox ID="choose" runat="server"
oncheckedchanged="choose_CheckedChanged" />
</td>
<td><%=list[i].f_id%></td>
<td><%=flowername.f_name%></td>
<td><%=flowername.cost_price%></td>
<td><%=list[i].fs_num%> </td>
<td><%=list[i].fs_choosestate%></td>
</tr>
<% }%>
</table>
<table width="100%" align="center" border="1">
<tr><td align="right" class="style2">
<asp:Button ID="Button1" runat="server" Text="下 单" onclick="Button1_Click" />
</td></tr>
</table>
</td></tr>
</table>
</div>
</form>
</body>
</html>
后台除了一个跳转,还没有想出别的代码︶︿︶
老哥们这种参数应该怎么传递,我怎么让系统知道我选中的是这个商品.(T▽T)