views:

39

answers:

0

ok i've defined a shared editor for string like the following

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%= Html.LabelFor(model => model) %>
<%= Html.TextBoxFor(model => model) %>
<%= Html.ValidationMessageFor(model => model) %>

now i'm calling the custom editor like this in another control

        <%= Html.EditorFor(model=>model.Username)%>
        <%= Html.EditorFor(model=>model.Email)%>
        <%= Html.EditorFor(model=>model.Password)%>

my model is like this

    [Required(ErrorMessage="Le nom d'utilisateur est requis.")]
    [DataType(DataType.Text)]
    [DisplayName("Nom d'utilisateur")]
    public string Username { get; set; }

    [Required(ErrorMessage = "L'email est requis.")]
    [DataType(DataType.EmailAddress)]
    [DisplayName("Courriel")]
    public string Email { get; set; }

    [Required(ErrorMessage = "Le mot de passe est requis.")]
    [ValidatePasswordLength]
    [DataType(DataType.Password)]
    [DisplayName("Mot de passe")]
    public string Password { get; set; }

The only display that is rendered is the Email field. The two others are not rendered ? If i remove the DataType.Text and DataType.Password then all the display fields are rendered ??

Very strange behavior...

Someone knows why ?