In a strongly typed view with @model System.Tuple<Person, List<Survey>>
I use inside each loop:
@Html.EditorFor(x => survey.Questions)
to pose questions in the "Review". It works flawlessly.
Now, I would also like to pass additional data into a custom template template. I did:
@Html.EditorFor(x => survey.Questions, new { htmlAttributes = new { PersonId = 1000 } })
and then in the Edtior Template I want to access this PersonId and display it.
This is the editor template I created (shortcut for questions):
@using WebApplication2.Models @model Question <div> @ViewData["PersonId"] </div>
but nothing is displayed.
How to pass PersonId = 1000 to this EditorTemplate correctly.
source share