Databind a List<System.Web.UI.WebControls.Image> to a repeater
<p>Im trying to bind a List of Images (<code>System.Web.UI.WebControls.Image</code>) to a repeater, but the image is shown as broken. It seems allright when I put a breakpoint inside the ItemDataBound-event, the DataItem is correct and have the correct ImageUrl. Yet, the result is wrong.</p>

<p>This code is very simple, but will be way more complex at the end. Binding a <code>List&lt;String&gt;</code> with ImageUrls wont help me in the end, since all images will have more unique properties aswell.</p>

<p>Repeater:</p>

<pre><code>&lt;asp:Repeater ID="repButtons" runat="server" OnItemDataBound="repButtons_OnItemDataBound"&gt;
    &lt;ItemTemplate&gt;
        &lt;asp:Image ID="imgButton" runat="server" /&gt;
    &lt;/ItemTemplate&gt;
&lt;/asp:Repeater&gt;
</code></pre>

<p>Making the list with images:</p>

<pre><code>List&lt;System.Web.UI.WebControls.Image&gt; myButtons = new List&lt;System.Web.UI.WebControls.Image&gt;();

Image myEditButton = new Image();
myEditButton.ImageUrl = "~/images/themes/pencil.png";

myButtons.Add(myEditButton);

repButtons.DataSource = myButtons;
repButtons.DataBind();
</code></pre>

<p>Databinding:</p>

<pre><code>protected void repButtons_OnItemDataBound(object sender, RepeaterItemEventArgs e)
{
    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    {
        Image myImage = (Image)e.Item.DataItem;

        Image imgButton = (Image)e.Item.FindControl("imgButton");

        imgButton = myImage;
    }
}
</code></pre>
