title: ASP.net validation from codebehind
body: <p>I created an entry template for data which is repeated several times. Now I want to make sure at least one of these items is filled in.</p>
  
  <p>the way I do this is use the Count property from a generic list List to see how many are are used(there's some logic in my control that allows me to just pick out the entries that are actually used).</p>
  
  <p>Is there any way I can add something to the validationsummary of the page to notify the user that at least one itme needs to be filled in. 
  I want to do the count-check in the code behind ...</p>
  
  <pre><code>if (EnteredClasses.Count &gt; 0)
  {
      //do stuff here
  }
  else
  {
      //show validation error
  }
  </code></pre>