Easily Validate a CheckBoxList
<p>Am trying to elegantly validate a CheckBoxList in ASP.NET webforms.  </p>

<p>Problem:  Unknown server tag 'cc:ValidateableCheckBoxList'. </p>

<pre><code>namespace fmwebapp1.UserControls
{
    [ValidationPropertyAttribute("ValidateableProperty")]
    public class ValidateableCheckBoxList : CheckBoxList
    {
        public string ValidateableProperty
        {
            get { return (this.Items.Cast&lt;ListItem&gt;().Where(i =&gt; i.Selected).Count() &gt; 0) ? "something was selected" : ""; }
        }
    }
}
</code></pre>

<p>In the same namespace as my aspx file:</p>

<pre><code> &lt;%@ Register Namespace="fmwebapp1.UserControls" Assembly="ValidateableCheckBoxList" TagPrefix="cc" %&gt;   
&lt;cc:ValidateableCheckBoxList runat="server" ID="cblFindTheSite"&gt;
                                        &lt;asp:ListItem&gt;The Press&lt;/asp:ListItem&gt;
                                        &lt;asp:ListItem&gt;blah1&lt;/asp:ListItem&gt;
                                        &lt;asp:ListItem&gt;blah2&lt;/asp:ListItem&gt;
                                                                                &lt;/asp:CheckBoxList&gt;
                                    &lt;div class="validators"&gt;
                                        &lt;asp:RequiredFieldValidator runat="server" ID="rfvTest" ControlToValidate="cblFindTheSite" Text="Failed validation" &gt;&lt;/asp:RequiredFieldValidator&gt;
                                    &lt;/div&gt;
</code></pre>
