//假设数据取到了
List
"1.jpg",
"2.jpg"
};
//存储当前图片索引
private int Pager
{
set {ViewState["page"] = value; }
get { return (int)ViewState["page"]; }
}
//上一张事件
private linkButton1Click(object sneder,eventArgs e){
if(Pager == 0){
Response.Write("到顶了");
reutrn;
}
Pager = Pager - 1;
BindImageMethod();
}
//下一张事件
private linkButton1Click(object sneder,eventArgs e){
{
if(Pager == imgs.Length){
Response.Write("到底了");
reutrn;
}
Pager = Pager + 1;
BindImageMethod();
}
//绑定图片方法
private void BindImageMethod(){
this.Image.src = imgs[Pager];
}
图片的地址应该存放在数据库中,然后写分页语句,将图片分页,linkbutton点击事件中传递参数调用分页语句,然后修改image控件的src属性
类似分页的做法就可以吧