2016-07-12 4 views
-1

私はTextBoxFor必須にしたい、私は値カスタム検証ヘルプ(MVC誰にでもできる)

  • 現金
  • マネーオーダー とDropDownListFor @Html.DropDownListFor(model => model.Payment)ていると私はTextBoxFor @Html.TextBoxFor(model => model.PaymentType)持っているユーザーのみを選択し、お金のためであればDropDownListForから、私はMVC確実なを持っていると私はここRequiredIf

を使用しようとしていた私のViewModelは

です
public string PaymentType { get; set; } 
public string Payment{ get; set; } 
+1

ショー[RequiredIf( "支払い==マネーオーダー"] ' –

+0

'を試してみましたが、 "money order")] ' – Mhmd

+0

あなたの助け:( – Mhmd

答えて

0

@Stephen Muecke

[RequiredIf("Payment", "money order")] 
関連する問題