简体   繁体   English

通过C#ASP.NET MVC _Layout视图中的视图模型获取数据

[英]Getting Data through View Model in C# ASP.NET MVC _Layout view

I am Using ASP.NET C# MVC. 我正在使用ASP.NET C#MVC。

I have a Table in Database Where I kept Layout Settings (Site name , Header text etc).With Log in I want to Show this on Appropriate place in _Layout view. 我在数据库中有一个表,用于保留布局设置(站点名称,标题文本等)。登录后,我想在_Layout视图中的适当位置显示此表。

What I am doing & want is I want to have a "View Model" Bind in _layout view With some Data (data comes from a action => service layer => data Layer). 我正在做的&想要的是我想有一个“视图模型”绑定到_layout视图中并带有一些数据(数据来自一个动作=>服务层=>数据层)。

Where i should give hand ?? 我应该在哪里伸出援手? what can I do ? 我能做什么 ?

Do you want to define a _layout page for you application which should have fixed sections like header, footer and then a middle section where different pages can populate them self. 您是否要为应用程序定义_layout页面,该页面应该具有固定的部分(例如页眉,页脚),然后是中间部分,不同的页面可以自行填充这些中间部分。 There are many examples on the web related to this. 网络上有许多与此相关的示例。 Search on Google "ASP.NET MVC layout pages". 在Google“ ASP.NET MVC布局页面”上搜索。 If you have any specific problem implementing any of those solutions, please post the question and people should be able to answer those. 如果您在实施这些解决方案时遇到任何具体问题,请提出问题,然后人们应该能够回答这些问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM