私はmvcの剃刀を使い始めました。mvcの剃刀の電子メールの妥当性検査のメッセージを示しています
と、検証エラーメッセージを赤で表示したいと思います。
ここは私のビューモデルです。
public class AViewModel
{
[Required(ErrorMessageResourceName = "EmailAddressRequired", ErrorMessageResourceType = typeof(Resources))]
[HomeController.EmailAddressAttribute(ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "EmailAddress_RegularExpression_ErrorMessage")]
public string EmailAddress { get; set; }
[HomeController.LocalizedDisplayNameAttribute("Password", NameResourceType = typeof(Resources))]
[Required(ErrorMessageResourceName = "PasswordRequired", ErrorMessageResourceType = typeof(Resources))]
[DataType(DataType.Password)]
public string Password { get; set; }
[HiddenInput(DisplayValue = false)]
public Guid id { get; set; }
}
私の見解は次のようなものになります。
<div class="left">
@Html.EditorForModel()
<br />
</div>
をそして、私のCSSは次のようになります。
.left { float:left; width:430px; margin:0 -480px 0 0;
padding:0 40px 20px 0; border-right:1px solid #DDD;}
何がCSSに変更する必要がありますか?
私が使用したビューでは@ Html.EditerForViewModel()です。 現在検証メッセージが黒で表示されています。 赤で表示するものはありますか?
CSSを使用してスパンのスタイルを設定しますか? MVC 3サンプルアプリケーションのログインページのCSSスタイルを見てみましょう。 – Brandon
私は自分のスタイルシートで更新しました – alice7