Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
private void Form1_Load(object sender, EventArgs e)
        {
            LoadReport();
            //  this.ReportViewer1.RefreshReport();
            // this.ReportViewer1.RefreshReport();
        }
        private void LoadReport()
        {
            try
            {
 
                GetData();
                ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;
                LocalReport localReport = ReportViewer1.LocalReport;
                // localReport.ReportEmbeddedResource = @"D:\Arvind\Projects\RDLC Report Practice\RDLC Report Practice\Report1.rdlc";
                localReport.ReportPath = @"D:\Arvind\Projects\RDLC Report Practice\RDLC Report Practice\Report1.rdlc"; //Server.MapPath("Reports/Report2.rdlc");
                //ReportViewer1.ProcessingMode = ProcessingMode.Local;
                this.ReportViewer1.Width = 400;
                this.ReportViewer1.Height = 300;
                ReportDataSource rds = new ReportDataSource();
                rds.Name = "Report1";
                rds.Value = dt;
                localReport.DataSources.Add(rds);
                //ReportViewer1.DataBindings.Add("StudentName", dt, "StudentID");//.LocalReport.repo.LocalReport.DataSources.Add(rds);
                //ReportViewer1.LocalReport.DataSources.Add(rds);
                // ReportViewer1.DataBindings.Add("Text", dt, "StudentID");
                ReportViewer1.RefreshReport();//.LocalReport.Refresh();
                localReport.DataSources.Clear();
                // ReportViewer1.Visible = true;
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }
 
        private DataTable GetData()
        {
            dt.Columns.Add("StudentID");
            dt.Columns.Add("StudentName");
            DataRow dr = dt.NewRow();
            dr["StudentId"] = 100;
            dr["StudentName"] = "Santhosh";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["StudentId"] = 101;
            dr["StudentName"] = "Kumar";
            dt.Rows.Add(dr);
            return dt;
        }
Posted 14-Nov-12 0:28am
Edited 14-Nov-12 0:41am
(no name)30.6K
v2
Comments
lukeer at 14-Nov-12 7:20am
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 315
1 OriginalGriff 273
2 Aajmot Sk 224
3 Marcin Kozub 210
4 Richard MacCutchan 200
0 OriginalGriff 7,853
1 Sergey Alexandrovich Kryukov 7,107
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100