title: How to set a hidden value in Razor
body: <p>I know that what I'm trying to do is bad idea, but I have specific constrains for now.</p>
  
  <p>I have multiple sites, using one and the same MVC3 code base. For one of them the requirement is to hide some required fields from the form.</p>
  
  <p>I know that the best approach is to modify the controller to set the defaults for these fields, but I'd like to achieve this modifying only the view for this particular site w/o changing the code.</p>
  
  <p>So, how do I set a particular model property to a default value in the view? The ideal should be something like:</p>
  
  <pre><code>@Html.HiddenFor(model =&gt; model.RequiredProperty)
  @model.RequiredProperty = "default"
  </code></pre>
  
  <p>EDIT: more explanation</p>
  
  <p>So, actually this is in a sub-view, which is used by 2 different main views. I need these properties set only if one particular main view is used, and not the others.</p>
  
  <p>So, I guess the setting to default need to go to that particular "main" view. Looks like I can not use HiddenFor in the sub-view, and then Html.Hidden in the main.</p>
  
  <p>Is there a way to check in the sub-view which is the outer view?</p>