asp.net mvc - Calling a view from the second project -
i have 2 projects in solution (asp.net-mvc). first project main, other project (1 simple controller , views (index, layout). want directly menu in project 1, refer index view of second project. added reference not know do. help?
ps: sorry english.
project 1
_layout.cshtml
<!doctype html> <html> <head> <meta charset="utf-8" /> <title>@viewbag.title</title> <link href="@url.content("~/content/site.css")" rel="stylesheet" type="text/css" /> <script src="@url.content("~/scripts/jquery-1.5.1.min.js")" type="text/javascript"></script> <script src="@url.content("~/scripts/modernizr-1.7.min.js")" type="text/javascript"></script> </head> <body> <div> <nav> <a href="@url.content("~")" id="current">home</a> <a href="@url.content( /* via link want index project 2 */)">test</a> </nav> </div> <div id="main"> @renderbody() </div> <div id="footer"> </div> </body> </html>
project 2
homecontroller.cs
namespace panel.controllers { public class homecontroller : controller { public actionresult index() { return view(); } } }
asp.net mvc default provider not support cross reference views. however, there few hacks found out when working in mvc-4 app, customizing virtualpathprovider
. david ebbo wrote razor generator.
you can find test/sample application in here. detail blog post. portablearea
in google.
though don't know when had been last updated these possible choices think.
Comments
Post a Comment