Asp.Net Mvc - Html.TextBox - Set Autofocus property

Posted by Melursus on Stack Overflow See other posts from Stack Overflow or by Melursus
Published on 2010-06-08T14:30:30Z Indexed on 2010/06/08 14:42 UTC
Read the original article Hit count: 283

Filed under:
|
|

In Html 5, there is an new attribute on textbox call autofocus.

The problem is it is a boolean value (there or not there)

It should look something like :

<input name="a" value="" autofocus>

I try :

<%= Html.TextBox( "a", null, new { autofocus } ) %>

But, it's give me an error because I'm not setting a value to autofocus...

I know I can do it manually, but can I do it with Html.TextBox ?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about .net-3.5