コード例 #1
0
ファイル: Products.aspx.cs プロジェクト: hantan2008/LEDCMS
        /// <summary>
        /// 绑定数据
        /// </summary>
        /// <param name="PageIndex">页码</param>
        private void ListDataBind(int PageIndex)
        {
            int num = 15, i = 0, j = 0;

            CMS.DAL.CMS_Product dal = new CMS.DAL.CMS_Product();
            CMS.DAL.CMS_ProductClass dalClass = new CMS.DAL.CMS_ProductClass();

            string strWhere = "";
            if (!string.IsNullOrEmpty(Request.QueryString["class"]))
            {
                string strclassid = Request.QueryString["class"];
                int classid = int.Parse(strclassid);
                CMS.Model.CMS_ProductClass model = dalClass.GetModel(classid);
                string classidlist = model.CMS_ClassIdList;//树结构列表

                StringBuilder strSql = new StringBuilder();
                strSql.Append("SELECT ID  FROM CMS_ProductClass");
                strSql.Append(" where CMS_ClassIdList like '" + classidlist + "%'");

                strWhere = " CMS_ProductClassID in ("+strSql.ToString()+")";
            }

            DataTable dt = dal.GetPagesAll(strWhere, PageIndex, num, out i, out j);
            this.PageNavigator1.PageCount = j;
            this.PageNavigator1.PageIndex = PageIndex;
            this.PageNavigator1.RecordCount = i;

            this.Repeater1.DataSource = dt;
            this.Repeater1.DataBind();
        }
コード例 #2
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        /// <param name="PageIndex">页码</param>
        private void ListDataBind(int PageIndex)
        {
            int num = 15, i = 0, j = 0;

            string strWhere = "";

            CMS.DAL.CMS_Product dal = new CMS.DAL.CMS_Product();

            DataTable dt = dal.GetPagesAll(strWhere,PageIndex, num, out i, out j);
            this.PageNavigator1.PageCount = j;
            this.PageNavigator1.PageIndex = PageIndex;
            this.PageNavigator1.RecordCount = i;
            gvdataList.DataSource = dt;
            gvdataList.DataBind();
        }