在asp.net mvc中如何使用Grid++ Report (銳浪報表) 在cshtml,razor中的處理方法
以官方的asp.net(csharp)中的第一個示例"1a.簡單表格"為例:檢視: <script src="./Scripts/CreateControl.js" type="text/javascript"></script><script type="text/Javascript">CreateDisplayViewerEx("100%", "100%", "@Url.Content("~/grf/1a.grf")", "@Url.Action("ViewTest_Query","Login")", true, "");</script>後臺:
public ActionResult ViewTest_Query() { return Content(OledbReportData.DoGenDetailData2("select * from Customers order by CustomerID").Getxml()); }
OledbReportData.DoGenDetailData2我自己寫的方法,就是返回一個dataset public static DataSet DoGenDetailData2(string QuerySQL) { OleDbConnection ReportConn = new OleDbConnection(OleDbConnStr); OleDbDataAdapter ReportDataAdapter = new OleDbDataAdapter(QuerySQL, ReportConn); DataSet ReportDataSet = new DataSet(); ReportConn.Open(); ReportDataAdapter.Fill(ReportDataSet); ReportConn.Close(); return ReportDataSet; }
在asp.net mvc中如何使用Grid++ Report (銳浪報表) 在cshtml,razor中的處理方法
以官方的asp.net(csharp)中的第一個示例"1a.簡單表格"為例:檢視: <script src="./Scripts/CreateControl.js" type="text/javascript"></script><script type="text/Javascript">CreateDisplayViewerEx("100%", "100%", "@Url.Content("~/grf/1a.grf")", "@Url.Action("ViewTest_Query","Login")", true, "");</script>後臺:
public ActionResult ViewTest_Query() { return Content(OledbReportData.DoGenDetailData2("select * from Customers order by CustomerID").Getxml()); }
OledbReportData.DoGenDetailData2我自己寫的方法,就是返回一個dataset public static DataSet DoGenDetailData2(string QuerySQL) { OleDbConnection ReportConn = new OleDbConnection(OleDbConnStr); OleDbDataAdapter ReportDataAdapter = new OleDbDataAdapter(QuerySQL, ReportConn); DataSet ReportDataSet = new DataSet(); ReportConn.Open(); ReportDataAdapter.Fill(ReportDataSet); ReportConn.Close(); return ReportDataSet; }