Is this by design in Razor Compilation?
A simple scenario that I've never seen before, but a colleague has just
hit - MVC3
Create an action method MyAction(int myProperty = 0)
Create a model that has a property MyProperty
Pass an instance of this model to a strongly typed view, but set the
property to 10 in code (don't use the query string parameter!)
In the view, Html.TextBoxFor(x => x.MyProperty)
This should render 10 in the text box.
Now call the action method MyAction?myProperty=8
Shouldn't this still render 10 in the text box?
I see that I can override the property discovered by the expression and
assume this is because they are the same name (query string parameter and
model property). Eveything is then in the ViewData but one overrides the
other.
Is this by design?
No comments:
Post a Comment