请问:VS2005中,Gridview显示出查询数据后,为什么aspnetpager分页控件不显示呢?
protectedvoidAspNetPager_GridView_PageChanged(objectsender,EventArgse){this.Page_Bind...
protected void AspNetPager_GridView_PageChanged(object sender, EventArgs e)
{
this.Page_Bind(this.GridView1, this.AspNetPager_GridView);
}
private void Page_Bind(GridView gv, Wuqi.Webdiyer.AspNetPager netpage)
{
DataSet ds = new DataSet();
string sql = this.Return_Sql();
ds=BF.Bind_GV2(this.GridView1,sql);
netpage.RecordCount = ds.Tables[0].Rows.Count;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.CurrentPageIndex = netpage.CurrentPageIndex - 1;
pds.PageSize = netpage.PageSize;
gv.DataSource = pds;
gv.DataBind();
gv.PageIndex = pds.CurrentPageIndex;
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
this.Bind();
} 展开
{
this.Page_Bind(this.GridView1, this.AspNetPager_GridView);
}
private void Page_Bind(GridView gv, Wuqi.Webdiyer.AspNetPager netpage)
{
DataSet ds = new DataSet();
string sql = this.Return_Sql();
ds=BF.Bind_GV2(this.GridView1,sql);
netpage.RecordCount = ds.Tables[0].Rows.Count;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.CurrentPageIndex = netpage.CurrentPageIndex - 1;
pds.PageSize = netpage.PageSize;
gv.DataSource = pds;
gv.DataBind();
gv.PageIndex = pds.CurrentPageIndex;
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
this.Bind();
} 展开
4个回答
展开全部
你是不是没有填写触发事件代码啊??
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
getdata();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
getdata();
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你设置一下AlwaysShow="True"这个属性
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
前台GridView中,AllowPaging设为TRUE,既然你写了PageIndexChanging的话,看看(右键--属性--事件)那有没选择!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把你绑定数据的代码贴出来啊,不然怎么知道错在哪
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询