First see the Dropdownlist
<asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="True">
<asp:ListItem>--Select--</asp:ListItem>
<asp:ListItem>Pen</asp:ListItem>
<asp:ListItem>Pencil</asp:ListItem>
<asp:ListItem>Rubber</asp:ListItem>
</asp:DropDownList>
Then for validate see the requiredfield validator
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="DropDownList1"
ErrorMessage="Value Required!" InitialValue="--Select--"></asp:RequiredFieldValidator>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
We need to set InitialValue property of the RequiredFieldValidator with the InitialValue of the DropDownList to make it work
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.

nore mosratiPosted Aug 22, 2017, 5:00 AM
Hi it's work thanks very good
vikas vyasPosted Aug 1, 2014, 2:14 AM
<asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="True"> <asp:ListItem value="0" >--Select--</asp:ListItem> <asp:ListItem>Pen</asp:ListItem> <asp:ListItem>Pencil</asp:ListItem> <asp:ListItem>Rubber</asp:ListItem> </asp:DropDownList> in the required field in initial value you should write "0"