Web Studyaspnet.blogspot.com Babyneed.blogspot.com

ASP.Net Web Developer Guide

Power By: eXTReMe Tracker Powered by Blogger  
 
 
 
 

 

 
Important Links
 
   
     
 
Sitemap
 
   
   
 
Reference
 
   

Sunday, March 26, 2006

The RangeValidator Control (Chapter 3)

You can use this control to check if an input is within an acceptable range. Suppose that we want to provide a textbox for collecting data on “number of dependents.”We want to enforce a constraint that this field should be from 0 to 10. Figure 3.55 illustrates the use of a RangeValidator in this particular situation.
Figure 3.55 Using the RangeValidator Control

In our code, we have used the type, minimumValue, and maximumValue properties of a RangeValidator to apply the constraint.We have applied the RangeValidator as follows:
(The complete code is available in Validator4.aspx.)
<asp:RangeValidator id="ranvDependents" runat="server"
display="static" controlToValidate="txtDependents"
errorMessage="Must be from 0 to 10"
type="Integer" minimumValue=0 maximumValue=10>
</asp:RangeValidator></br>

0 Comments:

Post a Comment

<< Home