I\'m trying to use Html.RenderPartial in acsx file and I\'m getting an error:
Compiler Error Message: CS1973: \'System.Web.Mvc.HtmlHelper\' has no a
In case anyone else made the same mistake I did:
@Model MyViewModel
This will treat your model as dynamic
@model MyViewModel
This is a correctly strongly typed view. Note the lack of capitalisation!
Note, that this is Razor, unlike the original question.
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.
The only way i found to pass eg. an IEnumerable was to create a local variable and pass in this one.
For Example
@{
IEnumerable<Demo.Models.Friend> friends = Model.Friends;
Html.RenderPartial("_FriendsList", friends);
}
Html.RenderPartial("_FriendsList", (IEnumerable<Demo.Models.Friends>)(Model.Friends));
did not work!