我正在尝试将此相册集成到我的 asp.net 网站中。我正在从数据库中选择 3 张图片的 url,并显示来自特定相册的这 3 张图片。现在的问题是,如果用户有多个相册怎么办?它应该能够在页面上生成与该用户关联的数据库中一样多的 Jquery 专辑。
<div class="image_stack" style="margin-left:300px" runat="server" >
<img id="photo1" class="stackphotos" runat="server" clientidmode="static" >
<img id="photo2" class="stackphotos" runat="server" clientidmode="static">
<img id="photo3" class="stackphotos" runat="server" clientidmode="static" >
</div>
public DataTable dt = new DataTable();
dboperation dbo = new dboperation();
protected void Page_Load(object sender, EventArgs e)
{
string q = "select photourl ,AlbumName from PhotoAlbum where UserId=42";
dt = dbo.Getdt(q);
string a = dt.Rows[0]["photourl"].ToString();
string b = dt.Rows[1]["photourl"].ToString();
string c = dt.Rows[2]["photourl"].ToString();
photo1.Src = a.Substring(1, a.Length - 1);
photo2.Src = b.Substring(1, b.Length - 1);
photo3.Src = c.Substring(1, c.Length - 1);
q = " select PhotoAlbum.AlbumId,PhotoAlbum.AlbumName from PhotoAlbum where UserId=42";
dt = dbo.Getdt(q);
drpalbum.DataSource = dt;
drpalbum.DataTextField = "albumname";
drpalbum.DataValueField = "albumid";
drpalbum.DataBind();
}
如果您需要查看更多代码,请告诉我。