title: Asp.Net MVC: Server Controls vs Html class to render controls?
body: <p>What are the advantages of rendering a control like this:</p>
  
  <pre><code>&lt;% Html.RenderPartial("MyControl") %&gt; or
  &lt;%=Html.TextBox("txtName", Model.Name) %&gt;
  </code></pre>
  
  <p>over the web Forms style:</p>
  
  <pre><code>&lt;uc1:MyControl ID=MyControl runat=server /&gt;
  </code></pre>
  
  <p>I understand that performance can be one reason because no object needs to be created but having the possibility of calling it from the codebehing just to do some basic rendering logic can be very useful. </p>
  
  <p>If this is discouraged then how you are suposed to deal with this scenarios:</p>
  
  <ul>
  <li><p>You need to make the control visible conditionally and you dont want to fill your HTML with rendering logic.</p></li>
  <li><p>You have <code>&lt;input type="text" value="&lt;%= Model.Name %&gt;" /&gt;</code> but you need to check if Model is null because otherways a NullPointerException will raise.</p></li>
  </ul>
  
  <p><strong>[EDIT]</strong> I asked this when I was beginning with ASP MVC, now I see the advantages of the MVC way like in Cristian answer.</p>