Formatting Input as Currency
In This Topic
The C1InputNumberExtender control allows you to formant input as currency. Set the NumberType property to Currency to take advantage of this feature.
- Create an ASP.NET Web application.
- Add a standard TextBox control to the main content of your page.
- Click the TextBox smart tag and select Add Extender from the Tasks menu.
- In the Extender Wizard, select C1InputNumberExtender and click OK. A C1InputNumberExtender control is added to the page and the TargetControlID is set to TextBox1.
- Select View | Properties Window in the Visual Studio menu.
- Click the drop-down list at the top of the Properties window and select TextBox1_C1InputNumberExtender.
- Set the C1InputNumberExtender.NumberType property to Currency.
- Set the C1InputNumberExtender.Value property to 25.5.
The markup should now look similar to the following:
<cc1:C1InputNumberExtender ID="TextBox1_C1InputNumberExtender" runat="server" NumberType="Currency" TargetControlID="TextBox1" Value="25.5">
</cc1:C1InputNumberExtender>
-
Press F5 to run the application. The text box displays the initial value of 25.5 formatted as $25.50. Enter any numeric value, and it is formatted as currency.