ComponentOne Input for ASP.NET AJAX: Input for ASP.NET AJAX Task-Based Help > C1NumericInput Tasks > Indicating the Number of Decimal Places

Indicating the Number of Decimal Places

The following example shows how you can easily indicate the number of decimal places to display for the C1NumericInput control.

To set the decimal places value using the Tasks menu:

1.   Open the C1NumericInput Tasks menu.

2.   Set the Value of the control to 2.345.

3.   Enter 3 for the DecimalPlaces value.

Note that even though you entered 2.345 for the Value, if you do not change the DecimalPlaces value to 3, only 2 decimal places (the default) will be displayed. That is, 2.34.

To set the decimal places value using .html markup:

To set the Value to 2.345 and the DecimalPlaces value to 3, use the following markup in the .aspx page:

 

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

DecimalPlaces="3"

Value="2.345">

</cc1:C1NumericInput>

To set the decimal places value using code:

To set the decimal places 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

' Set the numeric value

Me.C1NumericInput1.Value = 2.345

' Set the number of decimal places

Me.C1NumericInput1.DecimalPlaces = 3

      C#

// Set the numeric value

this.C1NumericInput1.Value = 2.345;

// Set the number of decimal places

this.C1NumericInput1.DecimalPlaces = 3;


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