foreach in ASP.net with nested runat="server"
<p>For the following code:</p>

<pre><code>&lt;% foreach (Entities.Core.Location loc in locations){ %&gt;
&lt;div class="place_meta"&gt;
&lt;img src="~/static/images/stars/star_25_sml.gif" runat="server" class="star_rating"/&gt;
&lt;/div&gt;
&lt;% }; %&gt;
</code></pre>

<p>I would like to display the star rating image for each location object displayed. However, only the first location object's star rating is displayed. For the rest, the image tag becomes <code>&lt;img class="star_rating" /&gt;</code></p>

<p>Am I missing anything in the syntax that allows the ability to have controls with runat=server within a foreach on the aspx page? This is with ASP.net 2.0.</p>

<p>I could possibly call a function in the codebehind or a display class to absolute map the URL but I am very curious if there is a solution to this problem.</p>

<p>Just for clarifications, the path to the image could possibly be different for each location object.</p>
