さて、これが私の状況です...劇的な一時停止...
MVCビューに次のTextAreaFor<>ボックスがあります。
<div class="editor-label">
<%: Html.LabelFor(model => model.Monday) %>
</div>
<div class="editor-field">
<%: Html.TextAreaFor(model => model.Wednesday, 6, 40, new { })%>
<%: Html.ValidationMessageFor(model => model.Monday) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.Wednesday) %>
</div>
<div class="editor-field">
<%: Html.TextAreaFor(model => model.Wednesday, 6, 40, new {})%>
<%: Html.ValidationMessageFor(model => model.Wednesday) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.Friday) %>
</div>
<div class="editor-field">
<%: Html.TextAreaFor(model => model.Friday, 6, 40, new {}) %>
<%: Html.ValidationMessageFor(model => model.Friday) %>
</div>
経験豊富な方は、開発時間を短縮するために強く型付けされたビューを使用していることに気付いたかもしれません。そのため、多くのデフォルト項目がここにあります。
TextAreaFor <>ボックスのデフォルト値を設定するにはどうすればよいですか?IE、テンプレートとして機能するテキストが必要な場合があります。ユーザーがこれらのtextAreasに追加するものはすべて、データベースに保存されます(そのためのバックエンドはすでに完全で機能しています)。投稿ASP.NETMVCに見られるように-強く型付けされたTextAreaにデフォルト値を設定するにはどうすればよいですか?、モデル変数がコントローラーに返送されるかどうかわからないため、このメソッドを使用できるかどうかはわかりません。
また、もう1つの簡単な質問(QuestionCeption)これらのtextAreasからデータベースにデータを保存した場合(SQL Server Express 2008を使用)、改行文字は保持されますか?
これが私が必要とするデフォルト値のサンプルです。
Traditional:
Healthy Lifestyle:
Chill out:
Vegetarian:
Soup:
Sandwich:
No thanks.