Saturday, 24 August 2013

Why DisplayFor does not post values to Action Method?

Why DisplayFor does not post values to Action Method?

When we post the form using below to Action Method, we can see the View
Model values in Parameter.
@Html.EditorFor(model => model.Foo)
When we post the form using below to Action Method, we can't see the View
Model values in Parameter.
@Html.DisplayFor(model => model.Foo)
So, in later case, w could us Hidden Fields. So, I think, w should not us
DisplayFor when it comes o post form values.
Question : Why DisplayFor does not post values to Action Method? Can we
discuss the internal mechanism for this ?

No comments:

Post a Comment