Image source missing while generating HTML elements dynamically in asp.net
<p>I have 4 rows in DataTable dt5. I am trying to generate certain html elements dynamically equal to number of times as the rows in dt5.
Visual studio code:</p>

<pre><code>&lt;% for(int i = 0; i &lt; dt5.Rows.Count; i++)
{
%&gt;
&lt;div id="Div1"  class="image_stack" style="margin-left:600px" runat="server" &gt;
&lt;img  class="stackphotos photo1" src="~/Images/3.jpg" clientidmode="static" runat="server" /&gt;
&lt;img  class="stackphotos photo2" src="~/Images/4.jpg" clientidmode="static" runat="server"/&gt;
&lt;img   class="stackphotos photo3" src="~/Images/5.jpg" clientidmode="static" runat="server"/&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;% } %&gt;
</code></pre>

<p>I am able to generate the html but the problem is  the desired html i.e (view source in mozilla) should be....
First Iteration code:</p>

<pre><code>&lt;div id="ContentPlaceHolder1_Div1" class="image_stack" style="margin-left:600px"&gt;
&lt;img src="Images/3.jpg" class="stackphotos photo1" /&gt;
&lt;img src="Images/4.jpg" class="stackphotos photo2" /&gt;
&lt;img src="Images/5.jpg" class="stackphotos photo3" /&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
</code></pre>

<p>but the result i am getting is (browser view source) ...</p>

<pre><code>&lt;div id="ContentPlaceHolder1_Div1" class="image_stack" style="margin-left:600px"&gt;
&lt;img class="stackphotos photo1" /&gt;
&lt;img class="stackphotos photo2" /&gt;
&lt;img class="stackphotos photo3" /&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;&lt;br /&gt;&lt;br /&gt;
</code></pre>

<p>As you can see the 'src' part is missing in the code generated .WHy is src missing?</p>

<p>OK, it seems to be working now thanks to Code Rider. 
now i am trying to get the src from datatable. </p>

<pre><code> for (int i = 0; i &lt; dt5.Rows.Count; i++)
     {
       string   a = dt5.Rows[0]["imageurl"].ToString();
       string b = dt5.Rows[1]["imageurl"].ToString();
       string c = dt5.Rows[2]["imageurl"].ToString();
  %&gt; 
   &lt;div id="Div1"  class="image_stack" style="margin-left:600px" runat="server" &gt;
    &lt;img id="Img1"  class="stackphotos photo1" src="&lt;%a%&gt;"   /&gt;
    &lt;img id="Img2"  class="stackphotos photo2" src="&lt;%b%&gt;"  /&gt;
      &lt;img id="Img3"   class="stackphotos photo3" src="&lt;%c%&gt;" /&gt;
 &lt;/div&gt;
     &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;% } %&gt;
</code></pre>
