- Make sure to add a ListItem with Text=’Please Choose’ and Value =”.
- Add a RequiredFieldValidator with ControlToValidate= <Dropdownlist1> and Display=’Dynamic’
- Add a ValidationSummary with ShowMessageBox =true
<asp:DropDownList id='DropDownList1' runat='server'>
<asp:ListItem Value=''>Please Choose</asp:ListItem>
<asp:ListItem Value='Faq'>Faq</asp:ListItem>
<asp:ListItem Value='Tips'>Tips</asp:ListItem>
<asp:ListItem Value='Tricks'>Tricks</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator id='RequiredFieldValidator1' style='Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 48px'
runat='server' ErrorMessage='Please Select an Item in the dropdownlist' ControlToValidate='DropDownList1'
Display='Dynamic'></asp:RequiredFieldValidator>
<asp:Button id='Button1' style='Z-INDEX: 104; LEFT: 128px; POSITION: absolute; TOP: 16px' runat='server'
Text='Button'></asp:Button>
<asp:ValidationSummary id='ValidationSummary1' style='Z-INDEX: 105; LEFT: 176px; POSITION: absolute; TOP: 72px'
runat='server' ShowMessageBox='True' ShowSummary='False'></asp:ValidationSummary>
Share with