SqlReader, Repeater controls and CommandArgument problem
<p>I have a repeater control that generates a list of links from a SqlReader. I'm trying to create a button alongside each link that will allow the user to delete that link. My original thought was to use the &lt;%#Eval("URL") %> expression in the Item template like below. However the CommandArgument in the ItemCommand method would always come back empty.</p>

<pre><code>&lt;asp:Repeater  ID="rptLinks" runat="server" onitemdatabound="rptLinks_ItemDataBound" 
                 onitemcommand="rptLinks_ItemCommand"&gt;
&lt;ItemTemplate&gt;&lt;a href="&lt;%# DataBinder.Eval(Container.DataItem, "URL") %&gt;" target="_blank"&gt;&lt;%# DataBinder.Eval(Container.DataItem, "URL") %&gt;&lt;/a&gt;&lt;asp:ImageButton visible="false" ID="btnDeleteLink" runat="server" ImageUrl="/Images/DeleteIcon.gif" CommandName="DELETE" CommmandArgument=&lt;%#Eval("URL") %&gt; /&gt;
&lt;/ItemTemplate&gt;
&lt;SeparatorTemplate&gt;&lt;br /&gt;&lt;/SeparatorTemplate&gt;
    &lt;/asp:Repeater&gt;
</code></pre>

<p>The next thing I tried was to use the ItemDataBound event to programatically set the CommandArgument, but I can't figure out what to cast the e.Item.DataItem into so I can reference the ["URL"] Item.</p>

<pre><code>protected void rptLinks_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
    ImageButton btnDelete;
    btnDelete = (ImageButton)  e.Item.FindControl("btnDeleteLink");
    if (btnDelete != null)
    {
        btnDelete.Visible = (bool)ViewState["LinkEditing"];

        string URL = ((WhatTypeGoesHere)(e.Item.DataItem))["URL"].ToString();
        btnDelete.CommandArgument = URL;

    }
}
</code></pre>
