示例#1
0
        private void LoadData()
        {
            var recordCount = DataSourceUtil.GetTotalCount();

            // 1.设置总项数(特别注意:数据库分页初始化时,一定要设置总记录数RecordCount)
            ViewBag.Grid1RecordCount = recordCount;

            // 2.获取当前分页数据
            ViewBag.Grid1DataSource = DataSourceUtil.GetPagedDataTable(pageIndex: 0, pageSize: 5, recordCount: recordCount);
        }
        private void ReBindGrid(string[] Grid1_fields, int Grid1_pageIndex, string ttbSearch)
        {
            var grid1 = UIHelper.Grid("Grid1");

            var recordCount = DataSourceUtil.GetTotalCount(ttbSearch);

            // 1.设置总项数(数据库分页回发时,如果总记录数不变,可以不设置RecordCount)
            grid1.RecordCount(recordCount);

            // 2.获取当前分页数据
            var dataSource = DataSourceUtil.GetPagedDataTable(pageIndex: Grid1_pageIndex, pageSize: 5, recordCount: recordCount, searchKeyword: ttbSearch);

            grid1.DataSource(dataSource, Grid1_fields);
        }
示例#3
0
        public ActionResult Grid1_PageIndexChanged(string[] Grid1_fields, int Grid1_pageIndex)
        {
            var grid1 = UIHelper.Grid("Grid1");

            var recordCount = DataSourceUtil.GetTotalCount();

            // 1.设置总项数(数据库分页回发时,如果总记录数不变,可以不设置RecordCount)
            grid1.RecordCount(recordCount);

            // 2.获取当前分页数据
            var dataSource = DataSourceUtil.GetPagedDataTable(pageIndex: Grid1_pageIndex, pageSize: 5, recordCount: recordCount);

            grid1.DataSource(dataSource, Grid1_fields);

            return(UIHelper.Result());
        }
示例#4
0
        public ActionResult Grid1_ReBindGrid(string[] fields, int pageIndex, int pageSize)
        {
            var grid1 = UIHelper.Grid("Grid1");

            var recordCount = DataSourceUtil.GetTotalCount();

            // 1.设置总项数(数据库分页回发时,如果总记录数不变,可以不设置RecordCount)
            grid1.RecordCount(recordCount);

            // 2. 设置每页显示项数(每页记录数改变时,要设置PageSize)
            grid1.PageSize(pageSize);

            // 3.获取当前分页数据
            var dataSource = DataSourceUtil.GetPagedDataTable(pageIndex: pageIndex, pageSize: pageSize, recordCount: recordCount);

            grid1.DataSource(dataSource, fields);

            return(UIHelper.Result());
        }
        private void LoadData()
        {
            string sortField     = "Gender";
            string sortDirection = "ASC";

            var recordCount = DataSourceUtil.GetTotalCount();

            // 1.设置总项数(特别注意:数据库分页初始化时,一定要设置总记录数RecordCount)
            ViewBag.Grid1RecordCount = recordCount;

            // 2.获取当前分页数据
            ViewBag.Grid1DataSource = DataSourceUtil.GetPagedDataTable(pageIndex: 0,
                                                                       pageSize: 5,
                                                                       recordCount: recordCount,
                                                                       sortField: sortField,
                                                                       sortDirection: sortDirection);

            ViewBag.Grid1SortField     = sortField;
            ViewBag.Grid1SortDirection = sortDirection;
        }