FindControl in a RoleGroup in a LoginView
<p>I can't seem to find a control in a login view.</p>

<p>The aspx is:</p>

<pre><code>&lt;asp:LoginView ID="SuperUserLV" runat="server"&gt;
    &lt;RoleGroups&gt;
            &lt;asp:RoleGroup Roles="SuperUser"&gt;
                    &lt;ContentTemplate&gt;  
                            &lt;asp:CheckBox ID="Active" runat="server" /&gt;&lt;br /&gt;
                            &lt;asp:CheckBox ID="RequireValidaton" runat="server" /&gt;
      &lt;/ContentTemplate&gt;
     &lt;/asp:RoleGroup&gt;
    &lt;/RoleGroups&gt;
&lt;/asp:LoginView&gt;
</code></pre>

<p>And the code behind is:</p>

<pre><code>if (Context.User.IsInRole("SuperUser"))
{
    CheckBox active = (CheckBox) SuperUserLV.FindControl("Active");
    if (active != null)
    {
     active.Checked = this.databaseObject.Active;
    }

    CheckBox require = (CheckBox) SuperUserLV.FindControl("RequireValidaton");
    if (require != null)
    {
     require.Checked = this.databaseObject.RequiresValidation;
    }
}
</code></pre>

<p>With a user in the right role, I can see the checkboxes, but the code behind doesn't populate them, the result of the findcontrol is null.</p>

<p>What am I missing? Thanks.</p>

<p><strong>Edit</strong>: Looks like my issue was when I am doing the <code>.FindControl</code> the loginview hasn't rendered to the screen and is returning null. Putting my code on a button and calling it after the page has rendered to the screen it works as I would expect.</p>

<p><strong>Edit 2</strong>: Seems the best place to put the code was <code>SuperUserLV_ViewChanged</code></p>
