Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a custom visual web part. Some images are coming from SharePoint picture library dynamically. now when a user click on any image, that picture and description should open in the same page. in a modal or pop-up or like in google image.

html:



<marquee id="gallery" style="height:350px; overflow:hidden" direction="up" SCROLLDELAY=10 >

<asp:Literal ID="ltrImage" runat="server" >
</marquee>

code behind:

using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb web = site.OpenWeb())
{

SPList PicLib = web.Lists.TryGetList("ImageScroll");

string Image = "";

SPListItemCollection listcol = PicLib.Items;
foreach (SPListItem item in listcol)
{

Image += "";

Image += "";

}


Image += "
" + "<img src='" + web.Url + "/" + item.Url + "' style='height:auto;width:350px;'/>" + "
" + item["Title"].ToString() + "
";
ltrImage.Text = Image;


}
}

What I have tried:

using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb web = site.OpenWeb())
{

SPList PicLib = web.Lists.TryGetList("ImageScroll");

string Image = "";


SPListItemCollection listcol = PicLib.Items;
foreach (SPListItem item in listcol)
{

Image += "";
Image += "";

}


Image += "
" + "<img src='" + web.Url + "/" + item.Url + "' style='height:auto;width:350px;'/>" + "
" + item["Title"].ToString() + "
";
ltrImage.Text = Image;


}
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900