Gridview 分页显示问题:
在vs 2008中,代码如下:
<asp:GridView ID="GridView1" runat="server" EnableTheming="true" AllowPaging="True" AutoGenerateColumns="False"
BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px"
CellPadding="4" CellSpacing="2" DataSourceID="BooksDataSource" ForeColor="Black"
Width="597px" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound" PageSize="5" >
在CS中的代码是:
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
/*取得查询的各个参数*/
string bookName = this.BookName.Text;
int bookTypeId = Int32.Parse(this.BookType.SelectedValue);
string author = this.Author.Text;
/*调用业务层得到查询的结果数据集*/
DataSet ds = new DataSet();
ds = (new BooksLogic()).QueryBooksInfo(bookName, bookTypeId, author);
/*将查询结果集绑定到gridview控件上*/
this.GridView1.DataSourceID = null;
this.GridView1.DataSource = ds;
this.GridView1.PageIndex = e.NewPageIndex;
this.GridView1.DataBind();
}
问题是这样的:第一页正常显示分页导航,但后面页中,分页导航就不见了。是什么问题?
具体点就是,在第一页中有 1 2 3 4页数导航数字,但当我点击2时,跳转到第二页是,这些导航页数就不见了
哪位大牛帮帮忙!先谢谢啦!