Esempio n. 1
0
        /// <summary>
        ///  将dt中数据分页显示    </summary>
        /// <param name="dt">DataTable</param>
        /// <param name="repeater">Repeater控件</param>
        /// <param name="UCPaging">UCPaging控件</param>
        /// <param name="panel">Panel控件</param>
        public static void Paging(DataTable dt, Repeater repeater, UCPagingOfMS ucp, Panel panel)
        {
            repeater.DataSource = dt;
            repeater.DataBind();
            int totalCount = 0;

            if (dt.Rows.Count > 0)
            {
                totalCount     = (int)dt.Rows[0]["TotalCount"];
                ucp.TotalItems = totalCount;
                panel.Visible  = false;
            }
            else
            {
                panel.Visible = true;
            }
            //if (dt.Rows.Count > 0)
            //{
            //    //totalCount = (int)dt.Rows[0]["TotalCount"];
            //    panel.Visible = false;
            //}
            //if (totalCount > listPager.PageSize)
            //{
            //    listPager.Visible = true;
            //}
            //listPager.TotalItems = totalCount;

            //if (dt.Rows.Count == 0)
            //{
            //    panel.Visible = true;
            //}
        }
Esempio n. 2
0
        /// <summary>
        ///  将dt中数据分页显示    </summary>
        /// <param name="dt">DataTable</param>
        /// <param name="repeater">Repeater控件</param>
        /// <param name="UCPaging">UCPaging控件</param>
        /// <param name="panel">Panel控件</param>
        public static void Paging(DataTable dt, GridView gv, UCPagingOfMS ucp, Panel panel)
        {
            gv.DataSource = dt;
            gv.DataBind();
            int totalCount = 0;

            if (dt.Rows.Count > 0)
            {
                totalCount     = (int)dt.Rows[0]["TotalCount"];
                ucp.TotalItems = totalCount;
                panel.Visible  = false;
            }
            else
            {
                panel.Visible = true;
            }
        }