As I understandd MVC framework html helpers (TextBoxFor, EditorFor) use reflection for defining the names of input elements to provide reverse binding to the model.
fo
I got used to rather long identifier names for the sake of clarity: FirstName
, LastName
and many other examples.
Do standard helpers support any attribute whcih allow abstract from model member names?
For XML serialization we have attributes XmlElement
, XmlAttribute
where we can set the name of the element.
Thus I need something like this:
public class Person
{
[Name("fn")]
public string FirtsName {get;set;}
[Name("ln")]
public string LastName {get;set;}
}
and now call to Html.TextBoxFor( model => model.FirstName)
should give <input id="fn" name="fn" type="text" value="" />