protected void BindBookList() { //这里做一些接收参数的判断 int pageIndex; if (!int.TryParse(Request["pageIndex"], out pageIndex)) { pageIndex = 1; } int pageSize = 10; BookManager bookManager = new BookManager(); int pageCount = bookManager.GetPageCount(pageSize); PageCount = pageCount; pageIndex = pageIndex < 1 ? 1 : pageIndex; pageIndex = pageIndex > pageCount ? pageCount : pageIndex; PageIndex = pageIndex; var bookList = bookManager.GetPageList(pageIndex, pageSize); BookRepeater.DataSource = bookList; BookRepeater.DataBind(); }
/// <summary> /// Shows the selected books on the screen. /// </summary> private void ShowBooks() { BookRepeater.DataSource = Session["BookList"]; BookRepeater.DataBind(); }