The binding framework of the ASP.NET MVC model tries to populate all the properties with data coming from the request object (query string, form fields, ...). Therefore, it creates an instance of all the controller parameters in order to try to match the properties. Since you are not passing SomeUsualField, it is null, but the parameter object has an empty instance.
You can initialize the SomeUsualField property when you call http: // localhost / MySite / MyController / Index? SomeUsualField = test . The SomeUsualField property will be automatically initialized using 'test'
If you do not want the parameter to be set, you can leave it and do the second action with the [HttpPost] attribute. A good tutorial is a music store .
public ActionResult Index() { var obj = new SomeModel(); return View(obj); } [HttpPost] public ActionResult Index(SomeModel obj) {
source share