asp.net-mvc - ِِ如何访问mvc 5中_viewstart.chtml中的viewbag?
问题描述
我需要根据 _viewstart.chtml 中的用户更改布局。我已经看到问题Why can't _ViewStart.cshtml access the ViewBag object?并且答案建议使用 ViewContext.ViewBag 但在 mvc 5 中我有错误
An object reference is required for the nonstatic field, method, or property
那么我如何在 _viewstart.chtml 中使用 viewbag 或 ViewContext。
解决方案
推荐阅读
- microsoft-graph-api - 如何使用 Microsoft Graph API 获取 Teams 中的活动 PSTN 呼叫列表
- java - 如何将 XML 数据发送到当前端点的服务器
- javascript - *ngFor 内的角度内容投影是否共享相同的数据?如何从父组件访问子组件的项目内容?
- java - 如何从 LocalDate JAVA 8 获取月份和年份?
- javascript - 如何在下拉 Reactjs 中添加 textFileds
- c# - 如何在安卓8.1真机上运行app
- excel - VB复制Excel迷你图
- sql - 根据另一列的值删除具有重复列值的行
- python - 查找包含字符串的列表子集的索引
- graphql - Lighthouse GraphQL - 找不到“orderBy”的指令