RangeValidator.MaximumValue Property
Gets or sets the maximum value of the validation range.
[Visual Basic] Public Property MaximumValue As String [C#] public string MaximumValue {get; set;} [C++] public: __property String* get_MaximumValue(); public: __property void set_MaximumValue(String*); [JScript] public function get MaximumValue() : String; public function set MaximumValue(String);
Property Value
The maximum value of the validation range. The default value is String.Empty.
Remarks
Use the MaximumValue property to specify the maximum 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 MaximumValue property to specify the maximum 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
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 | MinimumValue | Type | IsValid | String.Empty