Tuesday 30 October 2012

Create RDLC Report Chart in ASP.net


Add XSD page in your project
In this XSD Page you create a Data Table.. (Example Given Below)


Then Add a RDLC page in your Project.
In This rdlc page you add a chart (Tools --> Double click Chart ).

Set the DataSet in your rdlc page same as given below the image..

 then click the chart and set the x and y axis column name...


Then add a Aspx page . Drag a report Viewer in that aspx page...
 <rsweb:ReportViewer ID="rptViewer" runat="server" Width="700px">
  </rsweb:ReportViewer>


Then give the given below the query in your (ASPX) button click (or) page load event

        rptViewer.LocalReport.EnableExternalImages = true;
        rptViewer.ProcessingMode = ProcessingMode.Local;
        rptViewer.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
        rptViewer.LocalReport.DataSources.Clear();

        DataView dvChart = Obj_Admission.chart();
        rptViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.
ReportDataSource("", dtPayRpt.DefaultView));
        rptViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dvChart));
        rptViewer.LocalReport.Refresh();

Then run your project and see the result..
Thank You

No comments:

Post a Comment