EditorFor
doesn't accept htmlAttributes
as a parameter (which is what I think you're anticipating); that would be TextBoxFor
.
What you're doing is passing additionalViewData
to the editor template, so unless you're using that in your EditorTemplate, you won't actually be assigning an ID to the element (and therefore can't retrieve it with JS).
If you wanted to give the text field an ID, either customize your editor template, or use TextBoxFor
instead so you can pass it additional attributes:
@Html.TextBoxfor(x => x.StageId, new { id = "hiddenStageID" })
Unless I'm wrong (which I may be because I don't have the template visible in front of me. You may have customized it, in which case I'm just making an inaccurate assumption and I can update my answer).