如图,类似百度图片,点击下边的小图时能切换上边的大图。我现在仅仅是将小图显示出来了,下一步该怎么做呢?求大神指点...
上部分代码,下边的图是在for循环中生成的:
string sspk = Session.Contents["sspk"].ToString();
DataSet list1 = bllimage.GetList(" series_fk=" + sspk);
if (list1.Tables.Count > 0)
{
DataTable tab = list1.Tables[0];
for (int i = 0; i < tab.Rows.Count; i++)
{
ImageButton img = new ImageButton();
string id = "'" + i + "'";
img.ID = id;
this.Panel1.Controls.Add(img);
img.Height = 62;
img.Style["style"] = "margin-left:5px;margin-right:5px;border-color:Green;border-style:solid;border-width:1px";
string imgpath = tab.Rows[i][17].ToString();
int index = imgpath.IndexOf("Dicom_Images");
imgpath = imgpath.Substring(index);
imgpath = "~/" + imgpath;
int len = imgpath.Length;
imgpath = imgpath.Remove(len - 3);
imgpath += "bmp";
img.ImageUrl = imgpath;
img.Click += img_Click;
}
}
void img_Click(object sender, ImageClickEventArgs e)
{
ImageButton btn = (ImageButton)sender;
showimage(btn.ImageUrl);
}
我给img添加了点击事件,可是在调试页面点击的时候,发现页面重新加载了,而且上边的图也没有变,不是应该执行下边的img_click,然后执行showimage()函数呢?