cannot implicitly convert type void to object. .NET MVC PartialViewResult

后端 未结 4 1153
逝去的感伤
逝去的感伤 2021-02-02 04:59

I have the following controller action:

[ChildActionOnly]
public virtual PartialViewResult ListActions(int id)
{
    var actions = meetingActionRepository.GetAll         


        
相关标签:
4条回答
  • 2021-02-02 05:14

    Html.Partial should work as well :)

    @Html.Partial("View", Model);
    
    0 讨论(0)
  • 2021-02-02 05:19

    I had the same issue. What worked for me is to encapsulate the expression it in curly brackets.

    @{Html.RenderPartial("viewName", Model);}

    0 讨论(0)
  • 2021-02-02 05:29

    Like this:

    <p>
        @Html.Action(MVC.MeetingActions.ListActions(Model.MeetingId))
    </p>
    

    or if you insist on RenderAction like this:

    <p>
        @{Html.RenderAction(MVC.MeetingActions.ListActions(Model.MeetingId));}
    </p>
    

    Personally I prefer the first, makes fewer keystrokes.

    0 讨论(0)
  • 2021-02-02 05:30

    Difference between Html.RenderAction and Html.Action

    Different things for different purposes. Check out the above link.

    0 讨论(0)
提交回复
热议问题