Input Number Formatting Input as a Percentage
In This Topic
The C1InputNumberExtender control allows you to formant input as a percentage. Set the NumberType property to Percent 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 Percent.
- Set the C1InputNumberExtender.Value property to 50.
- Set the C1InputNumberExtender.DecimalPlaces property to 4.
- Set the C1InputExtenderBase.ShowSpinner property to True.
The markup should now look similar to the following:
<cc1:C1InputNumberExtender ID="TextBox1_C1InputNumberExtender" runat="server"
DecimalPlaces="4" NumberType="Percent" ShowSpinner="True"
TargetControlID="TextBox1" Value="50">
</cc1:C1InputNumberExtender>
-
Press F5 to run the application. The text box displays the initial value of 50 formatted as 50.0000%. Enter any numeric value, and it is formatted as currency.