TopGoods.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class TopGoods : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string sql;
sql = "select top 8 * from tb_Goods where 1=1";
if (Session["MC"] != null)
{
sql = sql + " and GoodsName like '%" + Session["MC"].ToString() + "%'";
}
if (Session["JG1"] != null)
{
sql = sql + " and Price>='" + Session["JG1"].ToString() + "'";
}
if (Session["JG2"] != null)
{
sql = sql + " and Price Price>='" + Session["JG2"].ToString() + "'";
}
DataSet result = DBHelper.GetDataSet(sql);
this.dlstGoods.DataSource = result;
this.dlstGoods.DataBind();
}
}
protected void dlstGoods_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "detail")
{
//获得当前商品编号
Int32 id = Int32.Parse(dlstGoods.DataKeys[e.Item.ItemIndex].ToString());
//在新窗口中弹出商品详细信息页面
Response.Redirect("goodsdetail.aspx?goodsid=" + id);
}
else if (e.CommandName == "buy")
{
//当前用户是否登陆? 只有登陆用户才可以购物
if (Session["MemberName"] != null)
{
int goodsid = Int32.Parse(dlstGoods.DataKeys[e.Item.ItemIndex].ToString());
后面还有 14 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
