开发者

Logic for Partial Views Used Across an App

开发者 https://www.devze.com 2023-04-03 21:12 出处:网络
How do I associate a PartialView which will be used across the app with a Child Action? For example the PartialView could be a login bar at the top of the page which will need to have some associated

How do I associate a PartialView which will be used across the app with a Child Action? For example the PartialView could be a login bar at the top of the page which will need to have some associated logic (loading the model etc) which I would normally put in a ChildAction. Ho开发者_如何学Pythonwever, I don't know what Controller will be used. I think I could create a base Controller class with the ChildAction and then inherit from that but I was hoping there would be a more elegant solution.


The RenderAction method allows for selecting the controller: http://msdn.microsoft.com/en-us/library/ee839451.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消