product.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class product : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
        DataSet ds = databaseAccess.GetDataSet("select product.productname,product.originalprice,category.categoryname,product.saleprice,product.photo,productID from product,category where product.categoryID=category.categoryID and product.categoryID=1");
        this.DataList1.DataSource = ds.Tables[0].DefaultView;
        this.DataList1.DataBind();

        //reader = cmd.ExecuteReader();
        //this.DataList1.DataSource = reader;
        //this.DataList1.DataBind();
        //conn.Close();
    }

    protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
    {

    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DataList1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        

        DataRowView MyDataRowView = (DataRowView)e.Item.DataItem;
        ((Label)e.Item.FindControl("productname")).Text = MyDataRowView.Row[0].ToString();
        ((Label)e.Item.FindControl("categoryname")).Text = MyDataRowView.Row[2].ToString();
        ((Label)e.Item.FindControl("originalprice")).Text = MyDataRowView.Row[1].ToString();
        ((Label)e.Item.FindControl("saleprice")).Text = MyDataRowView.Row[3].ToString();
        ((Image)e.Item.FindControl("photo")).ImageUrl = "images\\" + MyDataRowView.Row[4].ToString();
        ((Image)e.Item.FindControl("detial")).ImageUrl = "images\\detail.gif";

     }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Request.Cookies["userName"] != null)
            Response.Redirect("cart.aspx");
        else
           Response.Redirect("err.aspx");
后面还有 6 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。