ComponentOne Input for ASP.NET WebForms
Task-Based Help / C1InputNumeric Tasks / Indicating the Number of Decimal Places
In This Topic
    Indicating the Number of Decimal Places
    In This Topic

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

    To set the decimal places value using the Tasks menu:

    1. Open the C1InputNumeric 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:

    To write code in Source View

    <cc1:C1InputNumeric ID="C1InputNumeric1" runat="server"
    DecimalPlaces="3"
    Value="2.345">
    </cc1:C1InputNumeric>

    To set the decimal places value using code:

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

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ' Set the numeric value
    Me.C1InputNumeric1.Value = 2.345
    ' Set the number of decimal places
    Me.C1InputNumeric1.DecimalPlaces = 3
    

    To write code in C#

    C#
    Copy Code
    // Set the numeric value
    this.C1InputNumeric1.Value = 2.345;
    // Set the number of decimal places
    this.C1InputNumeric1.DecimalPlaces = 3;