<ul class="bjqs"> <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound"> <ItemTemplate><li> <asp:HyperLink ID="link" runat="server"> <img src='<%# DataBinder.Eval(Container.DataItem,"Value") %>' title='<%# (DataBinder.Eval(Container.DataItem,"Text").ToString()).Split('.')[0].ToString() %>' alt=""> </asp:HyperLink></li> </ItemTemplate> </asp:Repeater> </ul>
<pre lang="C#">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(); } } protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { ProductModel productModel = new ProductModel(); List<Product> products = productModel.GetAllProducts(); foreach (Product product in products) { Panel productPanel = new Panel(); HyperLink hp = (HyperLink)e.Item.FindControl("link"); hp.NavigateUrl = "~/pages/Product.aspx?id=" + product.ID; } }</pre>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)