How to ignore the “–Select–” in a dropdown during validation

The InitialValue helps to ignore the “–Select–” in a dropdown during validation.

<asp:DropDownList ID=”ProjNumDDL” runat=”server” Width=”90px” CssClass=”dropdownStyle”></asp:DropDownList>

<asp:RequiredFieldValidator ID=”ProjNumDDLVal” runat=”server” ErrorMessage=”*” CssClass=”smallTextFont” ControlToValidate=”ProjNumDDL” InitialValue=”–Select–“></asp:RequiredFieldValidator>

Advertisements