You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Html.Editor() and @Html.EditorFor() special-case an entry named "htmlAttributes" in the ViewDataDictionary (optionally augmented using additionalViewData parameters) when executing their default templates. MVC 5.2 issue #2142 is an indication this feature needs additional documentation. Users will otherwise search for ways to control generated HTML attributes when using these methods.
Couple of details:
"htmlAttributes" key is case-insensitive
entry is handled very similarly to the htmlAttributes object passed to input helpers such as @Html.HiddenFor() and @Html.TextBox()
Doesn't really matter what adds the key to ViewDataDictionary. It's most commonly done in the @Html.Editor[For]() call (using the additionalViewData parameter) because it's rare for the same HTML attributes to be correct for multiple calls in a view.
@Html.Display() and @Html.DisplayFor() also support additionalViewData parameters but don't check the merged ViewDataDictionary for the "htmlAttributes" key.
From @dougbu on October 6, 2014 17:5
@Html.Editor()
and@Html.EditorFor()
special-case an entry named "htmlAttributes" in theViewDataDictionary
(optionally augmented usingadditionalViewData
parameters) when executing their default templates. MVC 5.2 issue #2142 is an indication this feature needs additional documentation. Users will otherwise search for ways to control generated HTML attributes when using these methods.Couple of details:
htmlAttributes
object passed to input helpers such as@Html.HiddenFor()
and@Html.TextBox()
Copied from original issue: aspnet/Mvc#1233
The text was updated successfully, but these errors were encountered: