1
データ入力用のWebアプリケーションを構築しました(データの種類は重要ではありません)。このサイトの一部では、ユーザーがデータの行を動的に追加することができます。静的入力フィールドの場合は、フィールドの検証を管理できるようにDataAnnotationsを使用します。ダイナミックフィールドで同様のことをしようとすると、検証が機能しないように見えます。動的行の検証
私のアプリケーションの(一般的な)設定です。
[Data Input Page] -> [Partial Page for Dynamic Table] -> [Table is made up of individual rows (partial page)]
各ページは強く入力します。ここで
は、個々の行、部分的なページの例です:DataAnnotationsで動作するように検証を取得への任意の洞察力
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Models.Person>" %>
<tr>
<% using (Html.BeginCollectionItem("People")) { %>
<td class="ui-widget-content"><%= Html.TextBoxFor(model => model.Name) %></td>
<td class="ui-widget-content"><%= Html.TextBoxFor(model => model.Age) %></td>
<td class="ui-widget-content"><%= Html.TextBoxFor(model => model.PhoneNumber) %>
// [Cut] Some other, unimportant information here which allows a new row to be added.
</tr>
// This portion is not working - it does work with static fields.
<div class="validation">
<div><%: Html.ValidationMessageFor(model => model.Name)%></div>
<div><%: Html.ValidationMessageFor(model => model.Age)%></div>
<div><%: Html.ValidationMessageFor(model => model.PhoneNumber)%></div>
</div>
(それは私がすでにやっているものに似て/と同じです)になりますとても有難い。
ありがとうございました。それは質問に答えます。しかし、クレイジーなハック・イッシュ。 – JasCav