CSS autofocus on Html.TextBoxFor


Hello guys,

does anyone of you know how to set the autofocus property on @Html.TextBoxFor ?

Should look something like this

@Html.TextBoxFor(m => m.User, new {@PlaceHolder = "User name", @Autofocus })

But that doesn't work though.


Sep 01, 2015 14:30
@Html.TextBoxFor(x => x.User, new { placeholder = "Username", autofocus = ""})
Sep 01, 2015 14:40
<p>Thanks Dejan, works perfect.</p>
Sep 01, 2015 15:18
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.