简体   繁体   English

对于ASP.NET MVC Rescues View,我们如何添加ViewData字段?

[英]For ASP.NET MVC Rescues View, how do we add ViewData fields?

I have several Rescues defined for possible faults, however I am unable to access the ViewData to populate it with things we need the masterpage requires to render. 我为可能的故障定义了多个Rescues,但是我无法访问ViewData来填充我们需要呈现母版页所需的内容。 Is this hidden away in a controller we can utilize? 这隐藏在我们可以利用的控制器中了吗?

Sounds like you need ViewData to be made available in the masterpages... I think that will be a problem since not all the controllers put/assure that data is there. 听起来您需要在主页上提供ViewData ...我认为这将是一个问题,因为并非所有的控制器都放置/确保数据在那里。 I'm pretty sure you'd have to have some type of custom controller base to ensure consistent data in all of your controllers. 我很确定您必须具有某种类型的自定义控制器库,以确保所有控制器中的数据一致。 Try looking into this . 尝试调查一下

I might be wrong but I have seen this question brought up a few times before. 我可能是错的,但是我之前几次看到这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在ASP.NET MVC 4实体框架中仅将特定的数据库实体集添加到ViewData? - How do I add ONLY specific DB Entity Sets to the ViewData in ASP.NET MVC 4 Entity Framework? 我们可以将ViewModel分配给ASP.Net MVC中的ViewData对象吗? - Can we assign a ViewModel to a ViewData object in ASP.Net MVC? ViewData在View(ASP.NET MVC C#)中不显示内容 - ViewData not displaying content in View (asp.net mvc c#) 在ASP.Net MVC应用程序的视图中使用ViewData的替代方法 - Alternative way to use ViewData in the View of an ASP.Net MVC Application 如何在 asp.net mvc 中使用 ViewData 传递一个整数值,然后使用存储在 ViewData 中的值与视图中的另一个整数值进行比较? - How to pass an integer value using ViewData in asp.net mvc and then use value stored in ViewData to compare with another integer value in the view? ASP.Net MVC:如何使用列表 ViewData object 或从 controller 传递到视图的其他复杂对象 - ASP.Net MVC: How to use a List ViewData object or other complex objects passed from a controller to a view 在Windows MVC中将ViewData传递给ViewPage - Passing ViewData to ViewPage in ASP.NET MVC ASP.NET MVC ViewData Null - ASP.NET MVC ViewData Null MVC ASP.NET中的ViewData和ViewModel - ViewData and ViewModel in MVC ASP.NET asp.net MVC中的ViewData。*和TModel - ViewData.* and TModel in asp.net MVC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM