Check The Boundaries Of Input

Developers often need to validate a control based on a range of values. For these cases, you can use the RangeValidator Web server control. You can have different types of ranges, including ranges based on currency, dates, doubletype data, integer-type data, and string data. If the user does not type input that falls within a valid range, a validation message appears, and the user gets a chance to correct the form and resubmit it.

After you place a control on a server form, you can then use the <ASP:RANGEVALIDATOR RUNAT="Server"> tag to declare a

RangeValidator control. You must then specify the type of data you want to check, such as setting the type to Date. Then you need to specify the maximumvalue and minimumvalue attributes to give the range for valid input. To set the validation message, you add the text attribute and set it equal to the message.

For example, you can check a control to ensure that the user has put a date that falls within a specific range of dates. If the date falls outside this range, a validation message is displayed.

CHECK THE BOUNDARIES OF INPUT

CHECK THE BOUNDARIES OF INPUT

D Open the

GenericTemplate.aspx template from the Code Templates directory.

< Add a message to the user.

Q Add a message to the user and TextBox control to the form.

L-0 Add a Button control to the form.

L-H Add the RangeValidator control to the page.

D Open the

GenericTemplate.aspx template from the Code Templates directory.

< Add a message to the user.

Q Add a message to the user and TextBox control to the form.

L-0 Add a Button control to the form.

L-H Add the RangeValidator control to the page.

Was this article helpful?

0 0

Post a comment