aspnetpager 分页后为什么只有一页

golmjie golmjie 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区


protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Bing();
}

}


protected void Bing()
{

string s = "server=.\\sql2005;database=test;uid=sa;pwd=123456;";
SqlConnection conn = new SqlConnection(s);
string sql = "select * from [user]";
SqlCommand cmd = new SqlCommand(sql, conn);
SqlDataAdapter sda = new SqlDataAdapter(sql, conn);

DataSet Set = new DataSet();
sda.Fill(Set);


PagedDataSource pds = new PagedDataSource();
pds.AllowPaging = true;
pds.PageSize = AspNetPager1.PageSize;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.DataSource = Set.Tables[0].DefaultView;
gv.DataSource = pds;
gv.DataBind();


}



protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{

Bing();
}


我的数据库的数据有好几十条的。。为什么没有下一页按的了?只显示前的几条!
...全文
评论 10
收藏 已收藏
分享
返回顶部
golmjie
.NET社区 62,273 成员 668,968 内容