RANGE VALIDATION
Main Properties are
Properties
First - Add New Webform - select Label & Textbox & Button From ToolBox.
Select - Range Validator from Validation Tool - Select F4 Property Window - Control to Validate=txtPassword & Error Message required & Minimum Values & Maximum Values enter ( using Zero in front 06,07,08)
The RangeValidator control verifies that the input value falls within a predetermined range.
The RangeValidator control is used to check that the user enters an input value that falls between two values. It is possible to check ranges within numbers, dates, and characters.
DEMO
Html Coding
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr><td>
<asp:Label ID="Label1" runat="server" Text="Password"></asp:Label>
</td><td>
<asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1"
runat="server"
ControlToValidate="txtPassword"
ErrorMessage="Valid Range Only 5-10"
MaximumValue="10" MinimumValue="05"></asp:RangeValidator>
</td></tr>
<tr><td colspan="2">
<asp:Button ID="Button1" runat="server" Text="Save" />
</td></tr>
</table>
</div>
</form>
</body>
</html>
Properties | Description |
---|---|
Type | it defines the type of the data; the available values are: Currency, Date, Double, Integer and String |
MinimumValue | it specifies the minimum value of the range |
MaximumValue | it specifies the maximum value of the range |
Properties
Property | Description |
---|---|
BackColor | The background color of the RangeValidator control |
ControlToValidate | The id of the control to validate |
Display | The display behavior for the validation control. Legal values are:
|
EnableClientScript | A Boolean value that specifies whether client-side validation is enabled or not |
Enabled | A Boolean value that specifies whether the validation control is enabled or not |
ErrorMessage | The text to display in the ValidationSummary control when validation fails. Note:This text will also be displayed in the validation control if the Text property is not set |
ForeColor | The foreground color of the control |
id | A unique id for the control |
IsValid | A Boolean value that indicates whether the control specified by ControlToValidate is determined to be valid |
runat | Specifies that the control is a server control. Must be set to "server" |
Text | The message to display when validation fails |
First - Add New Webform - select Label & Textbox & Button From ToolBox.
Select - Range Validator from Validation Tool - Select F4 Property Window - Control to Validate=txtPassword & Error Message required & Minimum Values & Maximum Values enter ( using Zero in front 06,07,08)
Next - F5 Click - Run the Program
Enter out of Range Values Show the Error Message
Enter the valid Range - Hide the Error Message
0 comments:
Post a Comment