ASP.NET MVC Model Binders, html id

Posted by Stacey on Stack Overflow See other posts from Stack Overflow or by Stacey
Published on 2010-05-15T20:35:32Z Indexed on 2010/05/15 20:44 UTC
Read the original article Hit count: 158

Filed under:

Using the Model Binders in ASP.NET MVC 2.0, you can do something like this...

[DisplayName("User Name")]
public string Name
{
 get;
 set;
}

<%: Html.TextBoxFor( m => m.Name ) :%>

and then in your HTML, you get a result like this..

<label for="UserName">User Name</label>
<input type="text" id="UserName" name="UserName" />

That works fine, but I want to have better control over the HTML ID. Is there any way to do this through the model binding method?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2