私はMVC3が初めてです。たとえば、カスタム検証に問題があります
私の BasicInfoViewModel.cs では、
[Required]
[Display(Name = "State", ResourceType = typeof(Resources.Global))]
public string State { get; set; }
[Display(Name = "City", ResourceType = typeof(Resources.Global))]
public string City { get; set; }
私のBasicDetailsView.cshtmlでは、
<label>
<span class="td">@Application.Resources.Global.State</span>
@Html.DropDownListFor(m => m.State, (List<SelectListItem>)ViewData["State"])
</label>
<label>
<span class="td">@Application.Resources.Global.City</span>
@Html.DropDownListFor(m => m.City, (List<SelectListItem>)ViewData["City"])
</label>
stateプロパティがtrueを返す場合は、 "City"のみが必要です。そうでない場合、Cityは必要ありません。テキスト ボックスは無効にする必要があります。プレーンな html を使用しているため、 EditorForを使用していません。 DropDownListForを使用しています。誰でもこの問題を解決するのを手伝ってもらえますか? ありがとう...