3
I have the following class:
public class ModelHome
{
[Required]
[Display(Name = "Nome")]
public string Nome { get; set; }
[Required]
[Display(Name = "Email")]
public string Email { get; set; }
[Required]
[Display(Name = "Messagem")]
[DataType(DataType.MultilineText)]
public string Mensagem { get; set; }
}
Man Index
has a @Html.EditorFor
thus:
@Html.EditorFor(model => model.Nome, new { htmlAttributes = new { @class = "form-control input-lg required", @name = "name", @id = "name", @placeholder = "Name", @type = "text" } })
The annotation of Display
in the class I put to the Labelfor
already work based on it. But this EditorFor
mounts the following HTML:
<input class="form-control input-lg required text-box single-line" data-val="true" data-val-required="O campo Nome é obrigatório." id="name" name="Nome" placeholder="Name" type="text" value="">
The estate name
ALWAYS COMES Name, how I make her come name how are you in the @Html.EditorFor
?
My remarks:
- imput takes the class, so @class is working.
- I have already tried to pass the values on other constructor parameters, couldn’t.
- I tried to put
@name="name"
orname="name"
(without @), also not got.
The code is that right there that you put? I’m not able to make appear name no...
– Ricardo
I’m sorry, I misspelled. Look now.
– Leonel Sanches da Silva