how to create html using foreach loop
<p>I have an aspx form which has the following code </p>

<pre><code>&lt;div class="media packagesList"&gt;
    &lt;a class="media-left fancybox-pop" href="img/packages/package-list-01.png"&gt;
        &lt;asp:Image ID="imgThumbnail" runat="server" CssClass="media-object" /&gt;
    &lt;/a&gt;
    &lt;div class="media-body"&gt;
        &lt;div class="bodyLeft"&gt;
            &lt;h4 class="media-heading"&gt;
                &lt;a href="javascript.void(0)"&gt;
                    &lt;asp:Label ID="lblHeading" runat="server"&gt;&lt;/asp:Label&gt;
                &lt;/a&gt;
            &lt;/h4&gt;
            &lt;div class="countryRating"&gt;
                &lt;span&gt;
                    &lt;asp:Label ID="lblLocation" runat="server"&gt;&lt;/asp:Label&gt;
                &lt;/span&gt;
                &lt;ul class="list-inline rating"&gt;
                    &lt;li&gt;&lt;i class="fa fa-star" aria-hidden="true"&gt;&lt;/i&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;i class="fa fa-star" aria-hidden="true"&gt;&lt;/i&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;i class="fa fa-star" aria-hidden="true"&gt;&lt;/i&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;i class="fa fa-star" aria-hidden="true"&gt;&lt;/i&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;i class="fa fa-star" aria-hidden="true"&gt;&lt;/i&gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/div&gt;
            &lt;p&gt;
                &lt;asp:Label ID="lblDescription" runat="server"&gt;&lt;/asp:Label&gt;
            &lt;/p&gt;
            &lt;ul class="list-inline detailsBtn"&gt;
                &lt;li&gt;&lt;span class="textInfo"&gt;&lt;i class="fa fa-calendar" aria-hidden="true"&gt;&lt;/i&gt;
                    &lt;asp:Label ID="lblDate" runat="server"&gt;&lt;/asp:Label&gt;&lt;/span&gt;&lt;/li&gt;
                &lt;li&gt;&lt;span class="textInfo"&gt;&lt;i class="fa fa-clock-o" aria-hidden="true"&gt;&lt;/i&gt;
                    &lt;asp:Label ID="lblDays" runat="server"&gt;&lt;/asp:Label&gt;&lt;/span&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/div&gt;
        &lt;div class="bodyRight"&gt;
            &lt;div class="bookingDetails"&gt;
                &lt;h2&gt;
                    &lt;asp:Label ID="lblPrice" runat="server"&gt;&lt;/asp:Label&gt;&lt;/h2&gt;
                &lt;p&gt;Per Person&lt;/p&gt;
                &lt;a href="single-package-right-sidebar.html" class="btn buttonTransparent clearfix"&gt;Details&lt;/a&gt;
                &lt;a class="btn buttonTransparent" data-toggle="modal" href='.html'&gt;Inquiry&lt;/a&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>And the output is this?
<a href="https://i.stack.imgur.com/t55tN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t55tN.png" alt="enter image description here"></a></p>

<p>Please help me understand how to do this dynamically so I only have to write the code once and all the tours in the database will show in my tours page. </p>