在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;
}
文件用到的类都在官方示例中.
希望能帮到你.