您的位置:首页 > 编程语言 > ASP

数据空间配合aspnetpager分页控件试用

2013-06-12 15:20 417 查看
protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

SqlConnection con = new SqlConnection(strconn);

con.Open();

com = new SqlCommand();

com.Connection = con;

com.CommandText = "select count(*) from (select a.题名,b.id,b.MetaId,b.Videos_Path,b.Thumbnail_Path from dbo.MDLS_Literature_Metadata a left join MDLS_Literature_Videos b on a.SYSID=b.MetaId where b.id in(select min(id) from MDLS_Literature_Videos
group by MetaId) and a.资源类型='视频') as mm";

AspNetPager1.AlwaysShow = true;

AspNetPager1.PageSize = 15;

AspNetPager1.RecordCount = (int)com.ExecuteScalar();

con.Close();

RepeaterDataBind();

}

}

private void RepeaterDataBind()

{

dr = new SqlDataAdapter("select * from (select a.题名,b.id,b.MetaId,b.Videos_Path,b.Thumbnail_Path from dbo.MDLS_Literature_Metadata a left join MDLS_Literature_Videos b on a.SYSID=b.MetaId where b.id in(select min(id) from MDLS_Literature_Videos group
by MetaId) and a.资源类型='视频') as mm",strconn);

ds = new DataSet();

dr.Fill(ds, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize,"mmm");

this.ReVideos.DataSource = ds;

this.ReVideos.DataBind();

}

protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)

{

AspNetPager1.CurrentPageIndex = e.NewPageIndex;

RepeaterDataBind();

}

protected void AspNetPager1_PageChanged(object sender, EventArgs e)

{

RepeaterDataBind();

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: