ComponentOne Input for ASP.NET AJAX: Input for ASP.NET AJAX Task-Based Help > C1NumericInput Tasks > Setting the Min/Max Value

Setting the Min/Max Value

The following example demonstrates the C1NumericInput control's numeric range support with the ability to easily change MinValue and MaxValue properties.

To set the numeric values using the Tasks menu:

1.   Open the C1NumericInput Tasks menu.

2.   Enter 1 for the MinValue.

3.   Enter 1000 for the MaxValue.

4.   With the Tasks menu still open, enter 1 in the Value text box.

To set the numeric values using .html markup:

To set the MinValue to 1, the MaxValue to 1000, and the Value to 1, use the following markup in the .aspx page:

 

<cc1:C1NumericInput ID="C1NumericInput1" runat="server"

MaxValue="1000"

MinValue="1"

Value="1">

</cc1:C1NumericInput>

To set the numeric value using code:

To set the numeric value for the C1NumericInput control, double-click the Web page to create an event handler for the Load event. Enter the following code for the Page_Load event:

      Visual Basic

With C1NumericInput1

    .MaxValue = 1000

    .MinValue = 1

    .Value = 1

End With

      C#

this.C1NumericInput1.MaxValue = 1000;

this.C1NumericInput1.MinValue = 1;

this.C1NumericInput1.Value = 1;

Run the project and observe the following:

      With the input control displaying 1.00, click the Down spin button with your mouse pointer and notice that the control will not display a value lower than 1.00.

      With the input control displaying 1000.00, click the Up spin button with your mouse pointer and notice that the control will not display a value higher than 1000.00.


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.