This documentation is archived and is not being maintained.

RangeValidator.MinimumValue Property

Gets or sets the minimum value of the validation range.

[Visual Basic]
Public Property MinimumValue As String
[C#]
public string MinimumValue {get; set;}
[C++]
public: __property String* get_MinimumValue();
public: __property void set_MinimumValue(String*);
[JScript]
public function get MinimumValue() : String;
public function set MinimumValue(String);

Property Value

The minimum value of the validation range. The default value is String.Empty.

Remarks

Use the MinimumValue property to specify the minimum value of the validation range. If the value specified by this property fails to convert to the data type specified by the BaseCompareValidator.Type property, an exception is thrown.

Note   If you specify ValidationDataType.Date for the BaseCompareValidator.Type property without programmatically setting the culture for the application, you should use a culture-neutral format, such as YYYY/MM/DD, for the MaximumValue and MinimumValue properties. Otherwise, the date may not be interpreted correctly.

Example

[Visual Basic, C#] The following example demonstrates how to use the MinimumValue property to specify the minimum value of the validation range.

[Visual Basic] 

<%@ Page Language="VB" AutoEventWireup="True" %>

<html>

<head>

   <script runat="server">

      Sub ButtonClick(sender As Object, e As EventArgs)

         If Page.IsValid Then
         
            Label1.Text="Page is valid."
         
         Else
         
            Label1.Text="Page is not valid!!"
         
         End If

      End Sub

   </script>

</head>

<body>

   <form runat="server">

      <h3>RangeValidator Example</h3>

      Enter a number from 1 to 10:

      <br>

      <asp:TextBox id="TextBox1"
           runat="server"/>

      <br>

      <asp:RangeValidator id="Range1"
           ControlToValidate="TextBox1"
           MinimumValue="1"
           MaximumValue="10"
           Type="Integer"
           EnableClientScript="false"
           Text="The value must be from 1 to 10!"
           runat="server"/>

      <br><br>

      <asp:Label id="Label1"
           runat="server"/>

      <br><br>

      <asp:Button id="Button1"
           Text="Submit"
           OnClick="ButtonClick"
           runat="server"/>
            

   </form>

</body>
</html>


[C#] 

<%@ Page Language="C#" AutoEventWireup="True" %>

<html>

<head>

   <script runat="server">

      void ButtonClick(Object sender, EventArgs e)
      {

         if (Page.IsValid)
         {
            Label1.Text="Page is valid.";
         }
         else
         {
            Label1.Text="Page is not valid!!";
         }

      }

   </script>

</head>

<body>

   <form runat="server">

      <h3>RangeValidator Example</h3>

      Enter a number from 1 to 10:

      <br>

      <asp:TextBox id="TextBox1"
           runat="server"/>

      <br>

      <asp:RangeValidator id="Range1"
           ControlToValidate="TextBox1"
           MinimumValue="1"
           MaximumValue="10"
           Type="Integer"
           EnableClientScript="false"
           Text="The value must be from 1 to 10!"
           runat="server"/>

      <br><br>

      <asp:Label id="Label1"
           runat="server"/>

      <br><br>

      <asp:Button id="Button1"
           Text="Submit"
           OnClick="ButtonClick"
           runat="server"/>
            

   </form>

</body>
</html>

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

RangeValidator Class | RangeValidator Members | System.Web.UI.WebControls Namespace | MaximumValue | Type | IsValid | String.Empty

Show: