예제 #1
0
        public void Pagination()
        {
            string get = System.Web.Configuration.WebConfigurationManager
                         .ConnectionStrings["ProjectConnection"].ConnectionString;
            SqlConnection getConnection = new SqlConnection(get);
            SqlCommand    command       =
                new SqlCommand("SELECT  count(*)  FROM    YachtsNews  Where 1 = 1", getConnection);
            SqlDataAdapter loginAdapter = new SqlDataAdapter(command);
            DataTable      user         = new DataTable();

            loginAdapter.Fill(user);


            UserPagination.limit      = 5;                                //每頁數量
            UserPagination.totalitems = Convert.ToInt32(user.Rows[0][0]); //資料總量
            UserPagination.targetpage = "NewsIndex.aspx";                 //連結文字,例:pagination.aspx?page=100
            UserPagination.showPageControls();
        }
예제 #2
0
        public void Pagination()
        {
            string commandpage = File.ReadAllText(HttpContext.Current.Server.MapPath("/sys/UserPageCount.sql"));

            string get = System.Web.Configuration.WebConfigurationManager
                         .ConnectionStrings["ProjectConnection"].ConnectionString;
            SqlConnection getConnection = new SqlConnection(get);
            SqlCommand    command       =
                new SqlCommand(commandpage, getConnection);
            SqlDataAdapter loginAdapter = new SqlDataAdapter(command);
            DataTable      user         = new DataTable();

            loginAdapter.Fill(user);


            UserPagination.limit      = 2;                                //每頁數量
            UserPagination.totalitems = Convert.ToInt32(user.Rows[0][0]); //資料總量
            UserPagination.targetpage = "user.aspx";                      //連結文字,例:pagination.aspx?page=100
            UserPagination.showPageControls();
        }