renderpartial with null model gets passed the wrong type

I have a page: <%@ Page Inherits=”System.Web.Mvc.View<DTOSearchResults>” %> And on it, the following: <% Html.RenderPartial(“TaskList”, Model.Tasks); %> Here is the DTO object: public class DTOSearchResults { public string SearchTerm { get; set; } public IEnumerable<Task> Tasks { get; set; } and here is the partial: <%@ Control Language=”C#” Inherits=”System.Web.Mvc.ViewUserControl<IEnumerable<Task>>” %> When Model.Tasks is not null, … Read more

Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction

In ASP.NET MVC, what is the difference between: Html.Partial and Html.RenderPartial Html.Action and Html.RenderAction 13 s 13 Html.Partial returns a String. Html.RenderPartial calls Write internally and returns void. The basic usage is: // Razor syntax @Html.Partial(“ViewName”) @{ Html.RenderPartial(“ViewName”); } // WebView syntax <%: Html.Partial(“ViewName”) %> <% Html.RenderPartial(“ViewName”); %> In the snippet above, both calls will … Read more