The quick start guides you through the steps of adding an InputNumber control to your application. For information on how to add ASP.NET MVC Edition controls, see Adding Controls.
Follow the given steps to get started:
Create a new MVC application using the ComponentOne or VisualStudio templates. For more information about creating an MVC application, see Configuring your MVC Application topic.
Add a new Controller:
Default1Controller
).Add a View for the controller:
Default1Controller
) to open it.Index()
.Index.cshtml
to open it.Index.cshtml
file with the code given below to initialize a InputNumber control.
Razor |
Copy Code
|
---|---|
<div> <p> Enter an integer between zero and ten: </p> @(Html.C1().InputNumber().Value(0).Format("n0") .Min(0) .Max(10) .Placeholder("integer between zero and ten") ) </div> <div> <p> Edit the integer using spinner buttons:</p> @(Html.C1().InputNumber().Value(0).Format("n0") .Min(0) .Max(10) .Step(1) .Placeholder("integer between zero and ten") ) </div> <div> <p> Edit currency value:</p> @(Html.C1().InputNumber() .Value(100).Format("c") .Step(100).Min(100).Max(1000) .Placeholder("amount below $1,000") ) </div> <div> <p> Edit percentages:</p> @(Html.C1().InputNumber() .Placeholder("percentage") .Format("p0") .Step(.1) ) </div> |