Reputation: 39
Please, my senior code experts, I have a repeater that randomly display the images and text label from a folder using a jquery. I want to be able to select and click the current image such that it redirects to another page where the image details can be displayed. I will appreciate your help and contributions!
<div id="banner-fade">
<!-- start Basic Jquery Slider -->
<ul class="bjqs">
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<li>
<img src='<%# DataBinder.Eval(Container.DataItem,"Value") %>' title='<%# (DataBinder.Eval(Container.DataItem,"Text").ToString()).Split('.')[0].ToString() %>' alt=""></li>
</ItemTemplate>
</asp:Repeater>
</ul>
<!-- end Basic jQuery Slider -->
</div>
Below is the code behind...
protected void Page_Load(object sender, EventArgs e)
{
FillPage();
{
string[] filePaths = Directory.GetFiles(Server.MapPath("~/pages/Management/Images/Products/"));
List<ListItem> files = new List<ListItem>();
foreach (string filePath in filePaths)
{
string fileName = Path.GetFileName(filePath);
files.Add(new ListItem(fileName, "/pages/Management/Images/Products/" + fileName));
}
Repeater1.DataSource = files;
Repeater1.DataBind();
}
Upvotes: 0
Views: 231
Reputation: 11
Surround the <img>
with a link.
<a href="www.linkToPageHere.com">
<img src='<%# DataBinder.Eval(Container.DataItem,"Value") %>' title='<%# (DataBinder.Eval(Container.DataItem,"Text").ToString()).Split('.')[0].ToString() %>' alt="">
</a>
Upvotes: 1