Wednesday 8 October 2014

Range Validation Control in Asp.Net C#

No comments    
categories: ,
RANGE VALIDATION


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>


















0 comments:

Post a Comment