<asp:DropDownList runat="server" ID="ddl">
<asp:ListItem Text="-Select-" Value=""></asp:ListItem>
<asp:ListItem Text="One" Value="1"></asp:ListItem>
<asp:ListItem Text="Two" Value="2"></asp:ListItem>
<asp:ListItem Text="Three" Value="3"></asp:ListItem>
</asp:DropDownList>
<asp:CompareValidator ID="cvddl" runat="server" Text="Error"
ControlToValidate="ddl" Operator="NotEqual" ValueToCompare = ""
ValidationGroup="CreateRolls"></asp:CompareValidator>
I do want to validate dropdown, if select
is selected error should be thrown. Main aim is that the value should be empty.
Is there is any methord to validate like this . Please help me with this