Asp.Net Mvc - How to have a “controller” in shared view

后端 未结 5 2064
暖寄归人
暖寄归人 2020-12-24 11:45

I have a shared view in my _Layout.cshtml for my header named \"_Header.cshtml\".

I would like to display text and image from the database, so I need my controller t

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 12:19

    I hope the question you have asked is Like.... Can we have a controller for a Shared Layout View.

    Simple answer is No.

    To achieve this goal you have to create a partial view for the Same purpose and put it into you shared Layout. By that means you can achieve you Goal

提交回复
热议问题