How to use a RangeValidator to select Colors from a specific range

Platform: ASP.NET| Category: Miscellaneous

<asp:dropdownlist id='DropDownList1' runat='server'>
	<asp:ListItem Value ='#000000'>#000000</asp:ListItem>
	<asp:ListItem Value ='#ff0000'>#ff0000</asp:ListItem>
	<asp:ListItem Value ='#0000ff'>#0000ff</asp:ListItem>
	<asp:ListItem Value ='#00aacc'>#00aacc</asp:ListItem>
	<asp:ListItem Value ='#0000cc'>#0000cc</asp:ListItem>
	<asp:ListItem Value ='#cc0000'>#cc0000</asp:ListItem>
	<asp:ListItem Value ='#00ff00'>#00ff00</asp:ListItem>
</asp:dropdownlist>
<asp:rangevalidator id='RangeValidator1' runat='server' 
	ErrorMessage='Select a color between #00ff00 to #ff0000' ControlToValidate='DropDownList1'
	MaximumValue='#ff0000' MinimumValue='#00ff00'>
</asp:rangevalidator>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.