私はasp.netのレポートビューアを使用してレポートを作成しました。今私はそれもMVC 3で作成したいと思います。私はMVCにとって非常に新しいので、あなたからの指導を期待してください。ありがとう!!!MVC 3でレポートビューアを使用してレポートを生成する方法は?
2
A
答えて
0
実行時にデータセットを別々に設定し、それをレポートに関連付ける必要があります。
レポートウィザードを使用して最初にレポートを作成した場合は、使用できるデータセット定義(StudentDataSource.xsd)が作成されているはずです。このファイルを開くと、クエリのTableAdapterとともにクエリが表示されます。ここで
は...ケビンは、上記に言及質問(How can I use a reportviewer control in an asp.net mvc 3 razor view?)
AデフォルトDATASET1データセットと生成さStudentDataSet.xsdとStudentReport.rdlc報告書に基づいて、例です
ここで修正されPDFController内のファイル()アクションメソッド:
public FileResult File() {
// Create a new dataset
StudentDataSet ds = new StudentDataSet();
// Create and fill the Student data table
// using the Student table adapter
StudentDataSetTableAdapters.StudentTableAdapter dta =
new StudentDataSetTableAdapters.StudentTableAdapter();
dta.Fill(ds.Student);
// Create a new report datasource with
// Name = the dataset name in the report,
// Value = the populated data table.
ReportDataSource rds = new ReportDataSource();
rds.Name = "DataSet1";
rds.Value = ds.Student;
ReportViewer rv = new Microsoft.Reporting.WebForms.ReportViewer();
rv.ProcessingMode = ProcessingMode.Local;
rv.LocalReport.ReportPath = Server.MapPath("~/Reports/StudentReport.rdlc");
// Add the new report datasource to the report.
rv.LocalReport.DataSources.Add(rds);
rv.LocalReport.Refresh();
byte[] streamBytes = null;
string mimeType = "";
string encoding = "";
string filenameExtension = "";
string[] streamids = null;
Warning[] warnings = null;
streamBytes = rv.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
return File(streamBytes, mimeType, "StudentReport.pdf");
}
また、注意して、あなたは前の質問、YからASPXView.aspxページに、この同じコードを使用している場合MVCプロジェクトと使用しているデータセットテーブルアダプタの両方の名前空間をインポートする必要があります。
ASPXView.aspx
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<%@ Import Namespace="ProjectNamespace" %>
<%@ Import Namespace="ProjectNamespace.StudentDataSetTableAdapters" %>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>ASPXView</title>
</head>
<body>
<div>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
StudentDataSet ds = new StudentDataSet();
StudentTableAdapter dta = new StudentTableAdapter();
dta.Fill(ds.Student);
ReportDataSource rds = new ReportDataSource();
rds.Name = "DataSet1";
rds.Value = ds.Student;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/StudentReport.rdlc");
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
}
</script>
<form id="Form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:reportviewer id="ReportViewer1" runat="server" height="500" width="500" AsyncRendering="false"></rsweb:reportviewer>
</form>
</div>
</body>
</html>
関連する問題
- 1. レポートビューアを使用してasp.netでレポートを作成する方法
- 2. レポートビューアで「レポートが生成されています」を変更する方法
- 3. MVCのCrystalレポートのレポートビューア
- 4. SOAtestを使用してレポートを生成する方法
- 5. レポートビューアを使用してレポートを作成する必要があります
- 6. レポートビューアを使用してasp Webページからssrsレポートを開く方法
- 7. ロボティウムを使用してテスト結果レポートを生成する方法は?
- 8. レポートビューアを使用してレポートの総ページ数を取得
- 9. 非同期タスクを使用してレポートビューアを作成する方法
- 10. mvcを使用してノックアウトを使用してUIをJQueryで作成する方法3
- 11. LINQを使用してMVCでレポートを作成
- 12. MVC 3 Microsoft Wordレポートを作成文書
- 13. MVC 5 rdlcレポートでオブジェクトを使用する方法
- 14. Laravel - pdfレポートを生成する方法
- 15. ASP.net MVC 3 FileStreamResultを使用して.netコードで生成されたテキストを返す方法
- 16. Birtでレポートを作成し、ASP.NETで使用する方法
- 17. ActionLinkを使用してハッシュを生成する方法
- 18. DFSORTを使用してレポートを生成する
- 19. ActiveRecordを使用して効率的にレポートを生成する
- 20. 既存のjrxmlを使用してJasperServerでレポートを作成する方法は?
- 21. mvcの詳細ビューのpdfを生成する方法3
- 22. QPython 3を使用してGUIを作成する方法は?
- 23. Sqliteデータベースを使用してAndroidでExcelレポートを生成
- 24. TFS APIとSSRSを使用してプログラムでレポートを生成
- 25. Crystalレポートは、CrystalレポートビューアWPF
- 26. レポートビューアにrdlcレポートを表示しないで印刷する方法
- 27. SonarQube V6.3.2でpdf形式でレポートを生成する方法は?
- 28. Rを使用してpdf形式でレポートを生成するには
- 29. Maven 3.xでfindbugsのhtmlレポートを生成するには
- 30. Yiiレポートの生成方法
私がこの[質問] [1]の重複であると考えています。 [1]:http://stackoverflow.com/questions/6144513/how-can-i-use-a-reportviewer-control-in-an-asp-net-mvc-3-razor-表示 –
ありがとうKevin ...私はこの1つを試みたが、まだ私は問題に直面している... –
レポート処理中にエラーが発生しました。 studentdataset(私のデータセット) pleaz助けてください –