srkirkland/Html5MvcTemplates

additionalViewData ignored

Closed this issue · 2 comments

When I use @Html.EditorFor(expression, additionalViewData) the additionalViewData that I pass gets dropped. Is there a way for that to trickle down through the templates? For example, I would like to set the autofocus attribute on one of my fields.
Thanks!

Interesting, I'll look into this

jfoshee,
The additionalViewData parameter on @Html.EditorFor is not intended for
adding attributes like autofocus, class, title, etc. Yes this is a bit
annoying but I assume one of the reasons MVC is implemented in this manner
is that the result of EditorFor() may not be a single element. In the
interest of staying consistent with the ASP.NET MVC framework I don't want
to write some large translation code to shift viewData into attributes, but
of course you could in your project and still use Html5MvcTemplates for the
final type resolution.

Scott

On Sat, Aug 27, 2011 at 7:32 AM, jfoshee <
reply@reply.github.com>wrote:

When I use @Html.EditorFor(expression, additionalViewData) the
additionalViewData that I pass gets dropped. Is there a way for that to
trickle down through the templates? For example, I would like to set the
autofocus attribute on one of my fields.
Thanks!

Reply to this email directly or view it on GitHub:
#2