repeater 控件 的ItemCommand() 事件中,处理一个点击 购买ImageButton 的购物处理:
protected void repProductList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
switch (e.CommandName)
{
case "buy":
DataTable DT;
if (Session["product_shopping_cart"] == null)
{
DT = new DataTable(); DT.Columns.Add(new DataColumn("product_id", typeof(int)));
}
else
{
DT = (DataTable)Session["product_shopping_cart"];
}
在if()判断里面 ,为什么要实例一个Table, 然后往其中添加一个名为product_id 的列?是不是还要用这个方法添加该商品的其他属性列 ???????
protected void repProductList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
switch (e.CommandName)
{
case "buy":
DataTable DT;
if (Session["product_shopping_cart"] == null)
{
DT = new DataTable(); DT.Columns.Add(new DataColumn("product_id", typeof(int)));
}
else
{
DT = (DataTable)Session["product_shopping_cart"];
}
在if()判断里面 ,为什么要实例一个Table, 然后往其中添加一个名为product_id 的列?是不是还要用这个方法添加该商品的其他属性列 ???????
if(i>5)
{
list=new List<String>();
list.add("xx1");
}
让它在这个作用域里面是全局的!!