📄 classbig.aspx.cs
字号:
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;
public partial class ClassBig : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
bind();
}
public void bind()
{
Product pr = new Product();
string q = Request.Params["BigClass"].ToString();
this.AspNetPager1.RecordCount = pr.GetClassall(q).Rows.Count;
if (this.AspNetPager1.RecordCount == 0)
{
this.Label3.Text = "暂无该类产品";
}
this.HotProduct.DataSource = pr.GetClassall(q, 12 * (this.AspNetPager1.CurrentPageIndex - 1), 12).DefaultView;
this.HotProduct.DataBind();
//2*(this.AspNetPager1.CurrentPageIndex-1) 一下页从那条记录开始,2提取的记录最大数也就是分页的条数
}
protected void HotProduct_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "buy")
{
Session["id"] = ((Label)e.Item.FindControl("id")).Text;//商品编号
Session["Proname"] = ((Label)e.Item.FindControl("Proname")).Text;//商品名称
Session["MemberPrice"] = ((Label)e.Item.FindControl("MemberPrice")).Text;//商品单价
Response.Redirect("buy.aspx");
}
}
protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
this.AspNetPager1.CurrentPageIndex = e.NewPageIndex;
bind();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -