Reputation: 1606
I have :
@Html.EditorFor(model => model.name)
This display my user name but I want to override this name. So I tried this :
@Html.EditorFor(model => model.Password, new { value = "othertext"} )
But this doesn't work, I always have my user name.
Thanks for your help !
Upvotes: 0
Views: 1430
Reputation: 17288
The "additional view data" parameter on EditorFor sets up new view data to be used by your editor template(s). It does not make "extra objects" to be rendered as you seem to be using it here.
And as I understand you trying to set htmlAttributes
:
@Html.TextBoxFor(model => model.Password, new { value = "xxx" })
Upvotes: 2