Home   Cover Cover Cover Cover
 

Validity Checks

Web Page

/book/solutions/6/CheckField.aspx
<%@ Page Language="C#" %>
<html>
  <head>
    <title>Check a field for a positive numeric value</title>
  </head>
  <body>
    <h2>Enter a positive number</h2>
    <form method="post" Runat="server">
      <asp:TextBox ID="field" Runat="server" />
      <asp:RangeValidator ControlToValidate="field"
        MinimumValue="0" MaximumValue="2000000000" Type="Integer"
        Text="must be a positive number"
        Runat="server" />
    </form>
  </body>
</html>

Try it

Click here.