How to assign RequiredFiled Validator for DropDownList in Asp.Net
Ans:
<form id="form1" runat="server">
<div>
Select Gender :
<asp:DropDownList runat="server" ID="ddlList">
<asp:ListItem Text="Select" Value="0"></asp:ListItem>
<asp:ListItem Text="Male" Value="1"></asp:ListItem>
<asp:ListItem Text="Female" Value="2"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator runat="server" ID="rfv" ControlToValidate="ddlList" ForeColor="Red" InitialValue="0" ErrorMessage="Please Select Gender"></asp:RequiredFieldValidator><br />
<asp:Button runat="server" ID="btnsubmit" Text="Submit" />
</div>
</form>
Output: