Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Setting Model is ignored by display/editor templates #2

Closed
maxtoroq opened this issue Oct 6, 2013 · 1 comment
Closed

Setting Model is ignored by display/editor templates #2

maxtoroq opened this issue Oct 6, 2013 · 1 comment

Comments

@maxtoroq
Copy link
Owner

maxtoroq commented Oct 6, 2013

This is because HtmlHelper<> creates a copy of ViewData. The workaround is:

Model = Html.ViewData.Model = new MyModel();
@maxtoroq
Copy link
Owner Author

Sometimes you need to set ViewData.ModelMetadata.Model also.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant