次のような文字列の共有エディタを定義しました
<%@ Control Language = "C#" Inherits = "System.Web.Mvc.ViewUserControl"%>
<%= Html.LabelFor(model => model)%>
<%= Html.TextBoxFor(model => model)%>
<%= Html.ValidationMessageFor(model => model)%>
今、私は別のコントロールでこのようなカスタムエディタを呼び出しています
<%= Html.EditorFor(model=>model.Username)%>
<%= Html.EditorFor(model=>model.Email)%>
<%= Html.EditorFor(model=>model.Password)%>
私のモデルはこんな感じです
[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; }
レンダリングされる唯一の表示は、Eメールフィールドです。他の2つはレンダリングされませんか?DataType.TextとDataType.Passwordを削除すると、すべての表示フィールドがレンダリングされますか?
非常に奇妙な行動...
誰かが理由を知っていますか?