Repeater DataBind error
<p>Half a day spent on this one...</p>

<p>On a page, I have two repeaters like so:</p>

<pre><code>&lt;% if (String.IsNullOrEmpty(Request.QueryString["id"])) { %&gt;

    &lt;asp:Repeater ID="auth_items" runat="server"&gt;

        &lt;ItemTemplate&gt;
            &lt;a href="/admin/auth.aspx?action=view&amp;amp;id=&lt;%# Eval("id") %&gt;"&gt;&lt;%# Security.script(Eval("name").ToString()) %&gt;&lt;/a&gt;&lt;br /&gt;
        &lt;/ItemTemplate&gt;

    &lt;/asp:Repeater&gt;

&lt;% } else { %&gt;    

    &lt;asp:Repeater ID="auth_item" runat="server"&gt;

        &lt;ItemTemplate&gt;
        &lt;%# Security.script(Eval("name").ToString()) %&gt;
        &lt;/ItemTemplate&gt;

    &lt;/asp:Repeater&gt;    

&lt;% } %&gt;
</code></pre>

<p>and in code behind:</p>

<pre><code>if (String.IsNullOrEmpty(Request.QueryString["id"]))
    sql = "SELECT * FROM table1 ORDER BY attr1 DESC";
else
{
    id = Security.sql(Request.QueryString["id"]);
    sql = "SELECT * FROM table2 WHERE attr2=" + id;
}

s.OpenConn(sql);

if (String.IsNullOrEmpty(Request.QueryString["id"]))
{
    auth_items.DataSource = s.GetRead();
    auth_items.DataBind();
}
else
{
    auth_item.DataSource = s.GetRead();
    auth_item.DataBind();
}
</code></pre>

<p>The problem is that I get 'object reference not set to an instance of an object' on auth_item.DataBind().
First repeater works fine and displays the data, but the second one won't work and instead, throws me an error.
I debugged it and DataSource for the second repeater is not null, and sql returns a value.</p>

<p>What seems to be the problem?</p>

<p>Thank you!</p>
