Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

ViewData in partialview

$
0
0

I have a View. Inside view - PartialView. If I call Partial with the name and new ViewDataDictionary, based on new data - have error:

The model item passed into the is of type ViewDataDictionary MyViewModelType, but this ViewDataDictionary instance requires a model item of type MyPartialViewModelType.

If instead of the ViewData to give the object, error is gone.

Task and use: I use EditorForModel, so need write custom object.cshtml; For all properties object, need call valid editor template (string, bool, etc). I get from the model modelmetadata properties, and by type, call partialview with valid template.

What's my problem?

View http://pastebin.com/adRcBqaY

PartialView (sample for string) http://pastebin.com/iuP7ukds


Viewing all articles
Browse latest Browse all 9386

Trending Articles