Wednesday, January 16, 2019

ViewData.TemplateInfo.HtmlFieldPrefix in Razor

for="@(ViewData.TemplateInfo.HtmlFieldPrefix)[@i]_TextValues[0]"

 
 

Alright in the line above, the...

@(ViewData.TemplateInfo.HtmlFieldPrefix)

 
 

...part of all this in a partial can be set with a third parameter where the partial is called like so:

@Html.Partial("SurveyPartial", Model.PostSurveyQuestions,
      nameof(Model.PostSurveyQuestions))

 
 

"PostSurveyQuestions" is the magic string in this case.

No comments:

Post a Comment