Validate Asp.net DropDownList Control

In order to validate the dropdown with compare field validator:

<asp:DropDownList ID="drpTAdEditCLocation" runat="server"></asp:DropDownList>

                                <asp:CompareValidator ID="conTAdEditLocation" runat="server" CssClass="sfError" ErrorMessage="Select Location"
                                    ControlToValidate="drpTAdEditCLocation" ValidationGroup="ticAdEdit" ValueToCompare="-1" Operator="NotEqual"></asp:CompareValidator>

It validates the dropdown if selected text is equal to "Select Location"

Comments