5
シンプルなASP.NET MVCビューを持っていますが、モデルとしてはstring
がシンプルです。ASP.NET MVCアプリケーションでモデルがnullのときにEditorFor(..)が例外をスローする
例えば、私は次のことを行うとモデル値がnull
ある場合
@model string
は、ビューは、(発生したときに、このビュー/ページ/リソース上のユーザー第1ランド)、例外がスローされます。
Value cannot be null or empty.
Parameter name: name
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Value cannot be null or empty.
Parameter name: name
<td>@Html.EditorFor(model => model)</td>
どのように私は、文字列モデルの値がnullのときEditorFor(..)
を使用してinput box
を作成することができますか?
できません。フィールド名はどのような名前になりますか? – bzlm