1

Jquery では、クライアント側の入力フィールドの検証を無効にすることができます (ignore を使用)。MVC3 でも同じことを行う必要があります。

[DisplayName("Title")]
[Required]
public string Title { get; set; }

[DisplayName("OtherTitle")]
[Required]
public string OtherTitle{ get; set; }

.cshtml で

    <div class="editor-label">
    <span>
        @Html.LabelFor(x => x.Title)
    </span>
        @Html.DropDownListForNums(m => m.Title, new SelectList(new string[] { "Mr", "Ms", "Mrs", "Dr", "Professor", "OTHER" }, "Title"), "Title")
    </div>
    <div id="altTitle" class="editor-label">
       <span>
           @Html.LabelFor(x => x.OtherTitle)
       </span>
           @Html.TextBoxFor(x => x.OtherTitle, new { @class = "othertitle" })
   </div>

クライアント側で OtherTitle の入力フィールドの検証を無効にする方法

ありがとう

4

0 に答える 0