How do you add a boolean attribute in asp.net mvc?
Posted
by bmavity
on Stack Overflow
See other posts from Stack Overflow
or by bmavity
Published on 2010-04-09T13:16:14Z
Indexed on
2010/04/09
13:23 UTC
Read the original article
Hit count: 301
asp.net-mvc-2
|html-helper
I'm trying to output the following html using an html helper in asp.net mvc 2:
<input type="text" id="Name" name="Name" value="" autofocus />
I'm using this code now:
<%= Html.TextBoxFor(x => x.Name) %>
and I've tried
// results in <input ... autofocus="" />
<%= Html.TextBoxFor(x => x.Email, new { autofocus="" }) %>
// does not compile
<%= Html.TextBoxFor(x => x.Email, new { autofocus=null }) %>
Is there any way to accomplish what I'm looking for using an html helper?
© Stack Overflow or respective owner