Home > ASP.NET MVC > Html.RenderUserControl and ASP.NET MVC Preview 5

Html.RenderUserControl and ASP.NET MVC Preview 5

September 2nd, 2008

Html.RenderUserControl has been superceded by Html.RenderPartial

   1:  <% Html.RenderPartial("~/Views/Shared/MyControl.ascx") %> 
   2:  <% Html.RenderPartial("MyControl") %>

You can specify the full path to your user control as in the first example.  Or, if your user control is in the ~/Views/Shared folder, you can use the second example.

Notice that Html.RenderPartial does not produce a return..aka…the = is removed.

asp.net forums

Share and Enjoy:
  • Digg
  • Facebook
  • del.icio.us
  • Print this article!
  • E-mail this story to a friend!
  • Google
  • description
  • description
  • Live
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • Tumblr

ASP.NET MVC