我正在使用Visual Studio 2010.在此之前,我曾在Crystal报表上工作过,但现在我想使用报表查看器生成报表。由于我对这个主题不熟悉,请引导我。谢谢 !!!如何使用报表查看器在asp.net中创建报表
5
A
回答
8
基础教程为你
Adding and Configuring the ReportViewer Controls
Creating an ASP.NET report using Visual Studio 2010 - Part 1
Creating an ASP.NET report using Visual Studio 2010 - Part 2
Creating an ASP.NET report using Visual Studio 2010 - Part 3
How to use the Report Viewer Control to access a Reporting Services Server
1
我的代码工作创造报告业务类对象...
创建使用商务舱报表对象&的ReportViewer(ASP.NET/ C#) 1,创建学生班级
public class StudentClass
{
public int No { get; set; }
public string Name { get; set; }
public string Degree { get; set; }
}
2.创建学生库与GetStudents()函数
public class StudentRepository : StudentClass
{
public List<StudentClass> studentList = new List<StudentClass>();
public List<StudentClass> GetStudents()
{
StudentClass student1 = new StudentClass();
student1.No = 1;
student1.Name = "Bhuvana";
student1.Degree = "M.Tech";
studentList.Add(student1);
StudentClass student2 = new StudentClass();
student2.No = 2;
student2.Name = "Annie";
student2.Degree = "B.Tech";
studentList.Add(student2);
StudentClass student3 = new StudentClass();
student3.No = 3;
student3.Name = "Muthu Abi";
student3.Degree = "B.Tech";
studentList.Add(student3);
return studentList;
}
}
3.使用报表向导创建“StudentReport.rdlc”,然后选择数据源
4.In的Index.aspx添加脚本管理和报表查看器从工具箱(拖放)
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server">
</rsweb:ReportViewer>
</div>
5.Modify的Page_Load()方法的代码隐藏文件
public partial class Index : System.Web.UI.Page
{
StudentRepository sr = new StudentRepository();
List<StudentClass> sc = new List<StudentClass>();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report/Student.rdlc");
sc = sr.GetStudents();
IEnumerable<StudentClass> ie;
ie = sc.AsQueryable();
ReportDataSource datasource = new ReportDataSource("DataSet1", ie);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
}
}
}
6.Build而运行
相关问题
- 1. 使用报表查看器创建报表使用Mysql和C#
- 2. 如何使用HTML5报表查看器消费Telerik报表
- 3. 如何使用visual studio报表查看器来显示报表服务报表
- 4. 如何在报表查看器中生成多个报表
- 5. 如何在报表查看器中更改“生成报表”
- 6. 报表查看器
- 7. 如何在1个水晶报表查看器中查看多维报表?
- 8. 如何创建报表查看器绑定在VB.NET
- 9. C#asp.net报告和报表查看器(或的ReportViewer)子报告
- 10. 动态创建ASP.NET报表查看器Web控件的问题
- 11. 使用报表查看器在MVC 4中显示RDLC报告
- 12. Asp.Net MVC和报表查看器控件
- 13. 带报表查看器的ASp.net MVC?
- 14. 报表查看器导出为PDF(ASP.NET)
- 15. 直接打印asp.net报表查看器
- 16. 微软报表查看器ASP.NET
- 17. 如何将报表查看器11.0.0.0降级到报表查看器10.0.0.0
- 18. 如何使用MVC 3中的报表查看器生成报表?
- 19. 使用ASP.NET VB显示子报表数据到Microsoft报表查看器控件
- 20. Crystal Report:在报表查看器控件中居中报表
- 21. 无法使用报表查看器加载报表Visual Studio 2008
- 22. 在asp.net中使用报告查看器生成报告
- 23. 如何使用ext.net在asp.net c#中创建水晶报表?
- 24. RDLC报表查看器钻取报告
- 25. 基于ASP.NET的报表设计器Reporting Services 2008报表创建
- 26. 错误而使用报表查看器
- 27. 在单个报表查看器中显示多个报表
- 28. 在单个报表查看器中切换多个报表(.rdlc)
- 29. 在报表查看器中显示水晶报表控件
- 30. 无法在报表查看器中的报表之间切换
谢谢Pranay ...这些基本的教程是帮助我完全... – 2012-04-19 07:41:11
@SonamMohite - 你是欢迎..等待upvote对我的答案.. – 2012-04-19 07:43:08
嘿Pranay ....首先感谢帮助我。关于使用存储过程创建数据集并没有什么困惑。因为我已经使用DataSet和Table很好地工作,所以现在想试试这个。你可以为此发布代码。 – 2012-04-21 05:42:33