views:

100

answers:

1

Hello,

I try to use Html.RenderPartial in acsx file and and I've got error

Compiler Error Message: CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named 'RenderPartial' 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

<a href="/projects/<%=project.Id %>">
  <% Html.Label("fdf"); %>
  <% Html.RenderPartial("ProjectName", Model.Id); %></a></li>
 <%} %>

However I've import neccessary namespaces, so it won't be error at

<% Html.Label("fdf"); %>

Are there any methods to use Html.RenderPartial in ascx file?

+1  A: 

The compiler cannot choose the correct method because your Model is dynamic. Change the call to:

<% Html.RenderPartial("ProjectName", (int)(Model.Id)); %>

Or any other datatype Id is.

GvS