人々がいつどのようにエディター/ディスプレイテンプレートとHtmlヘルパーを使用しているか疑問に思っています。具体的には、エンティティをレンダリングするのではなく、さまざまなUIコントロールをレンダリングする際の使用について話します。
たとえば、私は次のATMのようなものを持っています:
<tr>
<th><%= Html.LabelFor(x => x.ActivityTypeId) %></th>
<td><%= Html.EditorFor(x => x.ActivityTypeList, "MultiSelectDropDownList")%></td>
</tr>
<tr>
<th><%= Html.LabelFor(x => x.Name) %></th>
<td><%= Html.EditorFor(x => x.Name) %></td>
</tr>
<tr>
<th><%= Html.LabelFor(x => x.Description) %></th>
<td><%= Html.DisplayFor(x => x.Description, "DisplayString")%></td>
</tr>
しかし最近、私はこれを行うべきかどうか疑問に思っています:
<tr>
<th><%= Html.LabelFor(x => x.ActivityTypeId) %></th>
<td><%= Html.MultiSelectDropDownList(x => x.ActivityTypeList)%></td>
</tr>
<tr>
<th><%= Html.LabelFor(x => x.Name) %></th>
<td><%= Html.EditorFor(x => x.Name) %></td>
</tr>
<tr>
<th><%= Html.LabelFor(x => x.Description) %></th>
<td><%= Html.DisplayString(x => x.Description)%></td>
</tr>
しかし、この2番目のオプションを使用する場合、ミドルエディターを使用する意味があります... Html.Textboxを使用するのは得策であり、好きなhtmlプロパティを設定できるという利点があります。
ここで人々がどのようなパターンを使用しているか興味があります...何かアイデアはありますか?
乾杯アンソニー