I am trying to make a dynamic html code through the cs code by using src from a dataset. (every item in the dataset is a src of another picture).It's the first time i am trying to do something like this and it doesn't work, any tips would be helpful :)
html code:
<asp:Literal ID="imageGallery" runat="server" />
cs (c#) code:
DataSet ds = new DataSet();
ds = DAL.GetBestPics();
imageGallery.Mode = LiteralMode.Encode;
string divStart = @"<div class='more-products-holder'><ul>";
imageGallery.Text += divStart;
foreach (DataRow item in ds.Tables[0].Rows)
{
string imageHTML = @"<li><a>
<img src='";
string mid = @"" + item.ToString();
string imageHTML2 = @"' /></a></li>";
imageGallery.Text += imageHTML;
imageGallery.Text += mid;
imageGallery.Text += imageHTML2;
}
string divEnd = @"</ul></div>";
imageGallery.Text += divEnd;
this.Controls.Add(imageGallery);