C2C.Web/goods/goodsSearch.aspx.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace C2C.Web.goods
{
    public partial class goodsSearch : System.Web.UI.Page
    {
        BLL.pubGoods bllGoods = new BLL.pubGoods();
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Page.Title = webName.GetWebName() + "-商品搜索";
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request["keywords"]))
                {
                    this.hfname.Value = Request["keywords"];
                    BindData(GetStrWhere());
                }
            }
        }

        private string GetStrWhere()
        {
            string str = "";
            if (this.hfname.Value != "")
            {
                str = " name like '%" + this.hfname.Value + "%' and [status]=1 and shopStatus=1 AND seller=1";
            }
            return str;
        }

        private void BindData(string strWhere)
        {
            int count = bllGoods.GetRecordCount(strWhere);//数据总条数
            int startIndex = (this.AspNetPager1.CurrentPageIndex - 1) * this.AspNetPager1.PageSize + 1;
            int endIndex = this.AspNetPager1.CurrentPageIndex * this.AspNetPager1.PageSize;
            this.Repeater1.DataSource = bllGoods.GetListByPage(strWhere, "id,orders ", startIndex, endIndex).Tables[0];
            this.Repeater1.DataBind();
            this.AspNetPager1.RecordCount = count;

            if (count <= 0)
            {
                //this.lbmsg.Visible = true;
            }
        }

        protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
        {
            this.AspNetPager1.CurrentPageIndex = e.NewPageIndex;
            BindData(GetStrWhere());
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindData(GetStrWhere());
        }
后面还有 2 行代码,购买后查看完整代码

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

AI 解读

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

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