ASP.NET
Topic: Sample Code: How to use a RangeValidator to Select Colors from a specific range

Ireland .NET Developer Alliance :: Forums

Page 1 of 1 (1 items)


Posted by Paschal on
                  <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>