本帖最后由 gotoStudy 于 2016-3-11 17:08 编辑
用的activeReport的版本是V10,添加好报表和WebViewer后,去访问报表提示找不到WebViewer,ascx文件和cshtml文件在一个文件夹下,求大神帮忙看下路由注册代码:
- routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
- routes.IgnoreRoute("ActiveReports.ReportService.asmx/{*pathInfo}");
- routes.IgnoreRoute("Grapecity.ActiveReports.Flash.v9.swf");
- routes.IgnoreRoute("{*allActiveReport}", new { allActiveReport = @".*\.ar9(/.*)?" });
- routes.MapRoute(
- name: "Default",
- url: "{controller}/{action}/{id}",
- defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
- );
复制代码
主代码如下
- public ActionResult ReportTest()
- {
- PageReport report = new PageReport(new FileInfo(Server.MapPath("~/RDLX/PageReport1.rdlx")));
- ViewData.Model = report;
- return View();
- }
复制代码
- <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
- <%@ Register Assembly="GrapeCity.ActiveReports.Web.v10" Namespace="GrapeCity.ActiveReports.Web" TagPrefix="ActiveReportsWeb" %>
- <head id="Head1" runat="server">
- <title>ReportViewer</title>
- </head>
- <script runat="server">
- void Page_Load()
- {
- ARWebViewer.Report = Model;
- }
- </script>
- <body>
- <hr />
- <ActiveReportsWeb:WebViewer ID="ARWebViewer" runat="server" style="margin-left:50px;margin-top:50px" Height="700px" Width="900px">
- </ActiveReportsWeb:WebViewer>
- </body>
复制代码
|