Child actions are not allowed to perform redirect actions. (Using PartialViews)

前端 未结 4 1716
隐瞒了意图╮
隐瞒了意图╮ 2021-01-24 00:26

I\'m trying to load my partial view with some data from database, but I\'m getting following issue when I run the application:

Child actions are not allo

4条回答
  •  梦毁少年i
    2021-01-24 01:24

    Hi you may try by changing this line @Html.Action("UnreadEmails", "Message") to like this @{Html.Action("Category","Home");}

    if the above doesnt work there are three other ways to render the partial view in mvc. those are

    Html.RenderPartial  
    Html.RenderAction
    Html.Partial
    

    you make use any one of the above and get your solution.

    Good example with comparision can be found here:http://www.dotnettricks.com/learn/mvc/renderpartial-vs-renderaction-vs-partial-vs-action-in-mvc-razor

    Hope it was helpful,kindly let me know your thoughts or feedbacks

    Thanks Karthik

提交回复
热议问题