When I pass some properties through querystring in url, for instance ..CustomAction?something=10
this value is passe to the view fields.
Suppose some simple POCO Class is simple like this:
class MyClass {
public int something {get;set;}
}
whenever or not I set the "somethig" value in controller before calling the view, for instance.
public ActionResult CustomAction(int something){
var entity = new MyClass() { something = 2};
return view(entity);
}
My view always shows the URL parameter 10
instead of 2
@model MyClass
@Html.EditorFor(model => Model.something)
If the URL is .../CustomAction
the value in the "editorFor" is set to 2 (as expected)
If the URL is .../CustomAction?something=10
the value in the URL (10) overrides the value in the model (2) and the "editorFor" field value is set to 10.
How can I avoid this parameter override?