asp.net mvc中应用Grid++ Report (基本应用示例)

cshtml文件:

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <script src="~/Report/CreateControl.js" type="text/javascript"></script>
</head>
<body>
    <script type="text/javascript"> CreateDisplayViewerEx("100%", "100%", '@Url.Content("~/Report/wcjGridTest.grf")', '@Url.Action("getDataForReport", "GridPrintTest")', true, ""); </script>
</body>
</html>

config文件:(如果是vs2013需要配置,目的是给iis的mime添加新的静态处理类型)

<system.webServer>
    <staticContent>
      <mimeMap fileExtension=".grf" mimeType="grf/gridreport" />
    </staticContent>
</system.webServer>

控制器:

 public class GridPrintTestController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult getDataForReport()
        {
            string xml = OracleHelper.Query("select * from NS_FEEDBACK_TYPE_DIC").GetXml();
            return Content(xml);
        }
    }

文章来源:http://blog.csdn.net/wcj920946195

你可能感兴趣的:(Net-MVC,Grid++报表)