InputNumber
InputNumber
Model Binding
This sample shows how to use model binding features with input controls.
Features
Description
This sample shows how to use model binding features with input controls.
Use InputNumberFor() instead of InputNumber().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MvcExplorer.Models; namespace MvcExplorer.Controllers { public partial class InputNumberController : Controller { public ActionResult ModelBinding() { var model = new CustomerOrder { ID = 101, Country = "China" , Count = 5, OrderTime = DateTime.Now, Product = "PlayStation 4" }; return View(model); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 | @model MvcExplorer.Models.CustomerOrder < div > < label > @Html .Raw(Resources.InputNumber.ModelBinding_Text2)</ label > @Html .C1().InputNumberFor(m => m.Count) @Html .C1().InputTimeFor(m => m.OrderTime) </ div > @section Description{ < p > @Html .Raw(Resources.InputNumber.ModelBinding_Text0)</ p > < p > @Html .Raw(Resources.InputNumber.ModelBinding_Text1)</ p > } |