asp.net – 在不使用MVC的情况下在WebPages中渲染部分
发布时间:2020-12-16 07:12:26 所属栏目:asp.Net 来源:网络整理
导读:我正在使用Razor和WebPages但没有MVC.我喜欢这种简单性,所以我对此使用MVC并不感兴趣.但是我希望能够将部分内容呈现在我的页面中.像菜单,页脚等 使用MVC,你可以这样: @ {Html.RenderPartial(“Footer”,Model);} 我想做类似的事情: @ {Html.RenderPartial(
我正在使用Razor和WebPages但没有MVC.我喜欢这种简单性,所以我对此使用MVC并不感兴趣.但是我希望能够将部分内容呈现在我的页面中.像菜单,页脚等
使用MVC,你可以这样: 我想做类似的事情: 我怎样才能实现我的目标? 解决方法
看看这个链接
http://www.mikesdotnetting.com/Article/151/Extending-ASP.NET-Web-Pages-Create-Your-Own-Helpers
希望对你有帮助 也尝试这个: <!DOCTYPE html> <html> <head> <title>Main Page</title> </head> <body> @RenderPage("/Shared/_Header.cshtml") <h1>Index Page Content</h1> <p>This is the content of the main page.</p> @RenderPage("/Shared/_Footer.cshtml") </body> </html> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 无法在实体框架模型中的MVC 4模板中使用Use
- asp.net-mvc – 服务层或存储库中的密码哈希等?
- asp.net-mvc – ASP.NET MVC – 无法绑定数组以查看模型
- asp.net – 作为Windows服务托管的c#WCF Restful Web服务的
- asp.net-mvc – 确保对控制器中创建的对象进行IDisposable调
- asp.net – 我找不到在visual studio 2010中从工具菜单生成
- asp.net – 从Application_BeginRequest()中设置后,AsyncLo
- asp.net-mvc – T4MVC @ Url.Action(MVC.Controller.Action
- 如何在Xamarin和Asp.net核心之间共享类库?
- asp.net core 3.0 中使用 swagger
推荐文章
站长推荐
- iis – w3wp.exe占用内存
- asp.net – 单元测试http处理程序?
- asp.net – 在运行时获取IIS绑定
- asp.net – Combres的路线(combres.axd)不起作用
- 细说ASP.NET Forms身份认证
- asp.net-mvc-4 – MVC 4中的HttpContext.Current
- asp.net-mvc – MVC 5 Owin Facebook Auth导致空
- asp.net-mvc-3 – 如何根据Screen vs Handheld切
- asp.net – Web API 2 – ApiController.Interna
- asp.net-core – ASP.NET 5中RegisterObject / Q
热点阅读