MVC5 Classic
Format as a Percentage

The wijinputnumber widget allows you to formant input as a percentage. Set the type option to percent to take advantage of this feature. See the InputNumber  > Percent sample of the MVC Control Explorer live demo at http://demo.componentone.com/ASPNET/MVCExplorer/inputnumber/Percent.

  1. Create an C1 ASP.NET MVC 5 Web Application.
  2. In the Solution Explorer, expand the Views | Shared folder and double-click _Layout.cshtml to open the file.
  3. Add the following markup within the <body> tags of the page. The starting value of the wijinputnumber will be 50
    <input type="text" id="textbox1" value="50%" />
          <h6>Options</h6>
          <p>value=50; decimalPlaces=4</p>
    
  4. After the closing </div> tags you added in the previous step, enter the following jQuery script to initialize the wijinputnumber widget and set the type option. You'll also include a spinner and set the number to have four decimal places.
    <script id="scriptInit" type="text/javascript">
                $(document).ready(function () {
                      $("#textbox1").wijinputnumber(
                      {
                          type: 'percent',
                          decimalPlaces: 4,
                          showSpinner: true
                      });
                });
          </script>
    
  5. Press F5 to run the application.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback