title: Validator for list box in asp.net
body: <pre><code>&lt;asp:ListBox ID="lst_newGrpMembers" 
               DataValueField="Name" 
               SelectionMode="Multiple"
               Width="120px" 
               ToolTip="Press ctrl to select multiple users" 
               runat="server"&gt;
  &lt;/asp:ListBox&gt;
  
  &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" 
                              runat="server" 
                              ControlToValidate="lst_newGrpMembers"
                              ErrorMessage="Atleast one member required" 
                              CssClass="Error" 
                              Text="*Atleast one member required"
                              ValidationGroup="CreateGroupValidationGroup"&gt;
  &lt;/asp:RequiredFieldValidator&gt;
  </code></pre>
  
  <p>I have a required field validator for a list box, it validates and shows error where there is no entry in the list box, but when I add item to the list box, it still shows error. When I select the list box item which I added and click submit it works fine. How to validate the list box.</p>