You can set a required field validator to a drop down list as follows
<asp:DropDownList ID="ddlItems" runat="server">
<asp:ListItem Text="<--Select Item-->" Value=""></asp:ListItem>
<asp:ListItem Text="Item 1" Value="1"></asp:ListItem>
<asp:ListItem Text="Item 2" Value="2"></asp:ListItem>
<asp:ListItem Text="Item 3" Value="3"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="ddlItems" runat="server" ErrorMessage="Please select an item" Text="Pelase select an Item"></asp:RequiredFieldValidator>
Monday, February 11, 2008
Adding required validator to DropDownList
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment