Example #1
0
        private void RptBind(string strWhere)
        {
            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            if (String.IsNullOrEmpty(strWhere))
            {
                strWhere = "IsLock = 0";
            }
            else
            {
                strWhere += " AND IsLock = 0";
            }

            DataSet  ds = dal.GetList(strWhere);
            DataView dv = ds.Tables[0].DefaultView;
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pds = new PagedDataSource();

            AspNetPager1.RecordCount = dv.Count;
            pds.DataSource           = dv;
            pds.AllowPaging          = true;
            pds.CurrentPageIndex     = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize             = AspNetPager1.PageSize;
            //获得总条数
            pcount = dv.Count;
            if (this.pcount == 0)
            {
                this.lbmsg.Visible = true;
                this.lbmsg.Text    = "暂时没有新闻";
            }
            //绑定数据
            rptList.DataSource = pds;
            rptList.DataBind();
        }
        private void RptBind(string strWhere)
        {
            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            if (String.IsNullOrEmpty(strWhere))
                strWhere = "IsLock = 0";
            else
                strWhere += " AND IsLock = 0";

            DataSet ds = dal.GetList(strWhere);
            DataView dv = ds.Tables[0].DefaultView;
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pds = new PagedDataSource();
            AspNetPager1.RecordCount = dv.Count;
            pds.DataSource = dv;
            pds.AllowPaging = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize = AspNetPager1.PageSize;
            //获得总条数
            pcount = dv.Count;
            if (this.pcount == 0)
            {
                this.lbmsg.Visible = true;
                this.lbmsg.Text = "暂时没有新闻";
            }
            //绑定数据
            rptList.DataSource = pds;
            rptList.DataBind();
        }
Example #3
0
        public static string latestNewsList()
        {
            Cms.DAL.NewsInfo dal    = new Cms.DAL.NewsInfo();
            StringBuilder    strTxt = new StringBuilder();
            DataSet          ds     = dal.GetList(5, "IsTop > 0 AND IsLock = 0", " PubTime desc");
            DataTable        tbl    = ds.Tables[0];

            if (tbl.Rows.Count > 0)
            {
                strTxt.Append("<dl>");
                for (int j = 0; j < tbl.Rows.Count; j++)
                {
                    DataRow row = tbl.Rows[j];
                    strTxt.Append("<dd style=\"height: 24px;\">");
                    strTxt.Append("<a class=\"productClass02\" href=\"NewsView.aspx?newsID=" + row["newsID"].ToString() + "\" style=\"position: relative;top: 5px; left: 15px;\">" + row["Title"].ToString() + "</a>");
                    strTxt.Append("</dd>");
                }
                strTxt.Append("</dl>");
            }
            else
            {
                strTxt.Append("暂无活动!");
            }
            return(strTxt.ToString());
        }
Example #4
0
        public void RptBind()
        {
            string strWhere = "";

            if (Session["strWhereNews"] != null && Session["strWhereNews"].ToString() != "")
            {
                strWhere += Session["strWhereNews"].ToString();
            }

            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            DataSet          ds  = dal.GetList(strWhere);
            DataView         dv  = ds.Tables[0].DefaultView;
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pds = new PagedDataSource();

            AspNetPager1.RecordCount = dv.Count;
            pds.DataSource           = dv;
            pds.AllowPaging          = true;
            pds.CurrentPageIndex     = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize             = AspNetPager1.PageSize;
            //获得总条数
            pcount = dv.Count;
            if (this.pcount > 0)
            {
                this.lbtnDel.Enabled = true;
            }
            else
            {
                this.lbtnDel.Enabled = false;
            }
            //绑定数据
            rptList.DataSource = pds;
            rptList.DataBind();
        }
Example #5
0
        public static string latestNewsList()
        {
            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            StringBuilder strTxt = new StringBuilder();
            DataSet ds = dal.GetList(5, "IsTop > 0 AND IsLock = 0", " PubTime desc");
            DataTable tbl = ds.Tables[0];

            if (tbl.Rows.Count > 0)
            {
                strTxt.Append("<dl>");
                for (int j = 0; j < tbl.Rows.Count; j++)
                {
                    DataRow row = tbl.Rows[j];
                    strTxt.Append("<dd style=\"height: 24px;\">");
                    strTxt.Append("<a class=\"productClass02\" href=\"NewsView.aspx?newsID=" + row["newsID"].ToString() + "\" style=\"position: relative;top: 5px; left: 15px;\">" + row["Title"].ToString() + "</a>");
                    strTxt.Append("</dd>");
                }
                strTxt.Append("</dl>");
            }
            else
                strTxt.Append("暂无活动!");
            return strTxt.ToString();
        }