asp.net mvc: directly assign value to model inside razor view
<p>I have below snippet inside my Create razor View:</p>

<pre><code>@Html.EditorFor(model =&gt; model.UnitPrice)
</code></pre>

<p>trying to directly set <code>UnitPrice</code> using statement like this:</p>

<pre><code>@Model.UnitPrice = 100;
</code></pre>

<p>I got something like null pointer exception : <code>Object reference not set to an instance of an object.</code></p>

<p>How can I assign constant value to a field before posting to create post method?</p>