DataList分页

来源:百度知道 编辑:UC知道 时间:2024/06/02 18:53:31
在asp.net 三层框架里面 怎么实现 datalist分页, 谁有代码发个 我要简单的 例子 灵符注释 没有注释不给分
还有就是怎么在前台页面上调用存储过程 用什么控件好

private void indexListBind()
{
try
{
string parID = Request.QueryString["id"].ToString();
int curPage = Convert.ToInt32(this.lb_pageIndex.Text) - 1;//获取当前页码,我用的是一个lable.当了中间变量
con = Admin_DB.getConn();
con.Open();
DataSet ds = new DataSet();
string Path = "~";
OleDbDataAdapter sda = new OleDbDataAdapter("select ID,'" + Path + "'+imagePath as imagePath,introduce from D_Picture where parID=@parID", con);
sda.SelectCommand.Parameters.Add(new OleDbParameter("@parID", parID));
sda.Fill(ds, "index");
System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();//实例化分页数据源
ps.DataSource = ds.Tables["index"].DefaultView;//将要绑定在datalist上的datatable给分页数据源
ps.AllowPaging = tru