请帮助在MVC中使用水晶报告。 [英] please help to use a crystal report in MVC.

查看:52
本文介绍了请帮助在MVC中使用水晶报告。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..



我很难在MVC中使用水晶报告。



在asp中我们在aspx页面中使用如



< CR:CrystalReportViewer ID =CrystalReportViewer2runat =serverAutoDataBind =trueReportSourceID =CrystalReportSource1 />

< CR:CrystalReportSource ID =CrystalReportSource1runat =server>

< report filename =crystalreport.rpt>







和aspx.cs页面



protected void Page_Load(object sender,EventArgs e)

{

ReportDocument reportdocument = new ReportDocument();

reportdocument.Load( Server.MapPath(CrystalReport.rpt));

CrystalReportViewer2.ReportSource = reportdocument;

}



这里我得到输出...但是在MVC View页面的情况下我将如何创建CrystalReportViewer con控制器......所以在控制器中我可以像下面那样通过...



ReportDocument rd = new ReportDocument();

rd。加载(Server.MapPath(〜/ Rpts /)+crystalreport.rpt);

CrystalReportViewer1.ReportSource = rd;

返回View();



但我在MVC视图页面中无法控制CrystalReportViewer ..



请帮我查找这个答案..



提前谢谢...

解决方案

首先尝试搜索google。

通过护目镜,你很少浪费你的时间并获得数千个快速结果。

看到这可能对你有用... :)



 DataSet ds = < span class =code-keyword> new  DataSet(); 
oleAdapter.Fill(ds);
ReportDocument rpt = new ReportDocument();
rpt.load();
rpt.Database.Tables [ 0 ]。SetDataSource(ds.Tables [ 0 ]) ;
这个 .crystalReportViewer1.ReportSource = rpt;


请你写下你的答案这里?

Hello everyone..

I am feeling difficulty to use a crystal report in MVC.

In asp we are using in aspx page like

<CR:CrystalReportViewer ID="CrystalReportViewer2" runat="server" AutoDataBind="true" ReportSourceID="CrystalReportSource1" />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<report filename="crystalreport.rpt">



and in aspx.cs page

protected void Page_Load(object sender, EventArgs e)
{
ReportDocument reportdocument = new ReportDocument();
reportdocument.Load(Server.MapPath("CrystalReport.rpt"));
CrystalReportViewer2.ReportSource = reportdocument;
}

here I am getting the output...but in case of MVC View page How I will create CrystalReportViewer control...so that in controller I can pass like below...

ReportDocument rd = new ReportDocument();
rd.Load(Server.MapPath("~/Rpts/") + "crystalreport.rpt");
CrystalReportViewer1.ReportSource = rd;
return View();

But I am not getting any control of CrystalReportViewer in MVC view page..

please help me to findout this answer..

Thanks in advance...

解决方案

first of all try to search in google.
By goggling , you lost your time very less and get thousands of quick results .
see this may be it is useful to you...:)

DataSet ds = new DataSet();
   oleAdapter.Fill(ds);
   ReportDocument rpt = new ReportDocument();
   rpt.load();
   rpt.Database.Tables[0].SetDataSource(ds.Tables[0]); 
   this.crystalReportViewer1.ReportSource = rpt;


would you please write your answer here?


这篇关于请帮助在MVC中使用水晶报告。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆