Thursday, September 11, 2014

ASP.NET MVC Razor Override "id" and “name” attribute with TextBoxFor

Use the code below as example to override the id or/and name attributes with TextBoFor, something really important to keep in mind is that "id" and "Name" is case sensitive.
    
   @Html.TextBoxFor(x => x.Data, new { Name = Model.Name + "_Custom", id = Model.ID + "_Custom" })


No comments:

Post a Comment