title: How do I render HTML from the Viewbag using MVC3 Razor
body: <p>I am trying to pass a form element into an MVC3 view by using the Viewbag and simply write the HTML to the page ...</p>
  
  <p>In controller:</p>
  
  <pre><code>ViewBag.myData = "&lt;input type=""hidden"" name=""example"" value=""examplevalue""&gt;";
  </code></pre>
  
  <p>In view (I know I could use a helper for the form):</p>
  
  <pre><code>&lt;form action="http://exampleurl/examplepage" method="post" id="example-form"&gt;
  @ViewBag.myData
  &lt;input type="hidden" name="anotherexample" value="anotherexamplevalue" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This renders the myData as text in the HTML i.e.:</p>
  
  <pre><code> &amp;lt;type="hidden" name="example" value="examplevalue"&amp;gt; 
  </code></pre>
  
  <p>So my question is how do I get Razor to do the equivalent of older:</p>
  
  <pre><code>&lt;%= myData %&gt;
  </code></pre>
  
  <p>and not replace the &lt;></p>
  
  <p>Thanks
  Paul</p>