RenderPartial from different folder in RAZOR

Posted by Dien on Stack Overflow See other posts from Stack Overflow or by Dien
Published on 2010-12-24T04:49:08Z Indexed on 2010/12/24 4:54 UTC
Read the original article Hit count: 471

Filed under:
|
|
|

I've been trying to convert my aspx pages to cshtml and having an issue with rendering partial pages from another folder.

What I used to do:

<% Html.RenderPartial("~/Views/Inquiry/InquiryList.ascx", Model.InquiryList.OrderBy("InquiryId", MvcContrib.Sorting.SortDirection.Descending));%>

I would think that the equivalent would be:

@Html.RenderPartial("~/Views/Inquiry/_InquiryList.cshtml", Model.InquiryList.OrderBy("InquiryId", MvcContrib.Sorting.SortDirection.Descending))

This is obviously not working, I am getting the following error.

CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named 'Partial' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.

How would I achieve this with using the Razor view engine?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET