[英]Call Partial Aspx inside razor MVC3 page
i want to call partial ReportViewer.aspx from a page in MVC3 project but the partial cant find the location and show an error like this how can i resolve it? 我想从MVC3项目中的页面调用Partial ReportViewer.aspx,但是部分无法找到位置并显示这样的错误,我该如何解决呢?
Error location didn't show .aspx location in all path 错误位置未在所有路径中显示.aspx位置
the global asax route of my project : 我的项目的全球Asax路线:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Account", action = "Login", id = UrlParameter.Optional },
new[] { "ISpace.Controllers" }
);`
您可以在路由器配置中进行设置:
routes.MapPageRoute("Test", "Test/{Controller}/{ActionName}", "~/Views/{Controller}/{ActionName}.aspx");
after researching in google and i got this link from stackoverflow it solve my question, i should register viewengine for webform and razor. 在谷歌研究后,我从stackoverflow得到了这个链接,它解决了我的问题,我应该为webform和razor注册viewengine。 here is the code from that link
这是该链接的代码
protected void Application_Start()
{
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
ViewEngines.Engines.Add(new WebFormViewEngine());
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.