We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon
Starting in 2019, the Reporting control is no longer included in Essential Studio. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

How to bind datasource to chart report on OnReportLoaded

Hi Team,

I have created rdlc file which contains chart and want to bind datasource on OnReportLoaded event for that I have used for code.

public void OnReportLoaded(ReportViewerOptions reportOption)
{
GetReportViewerData objGetReportViewerData = new Areas.DX.Models.GetReportViewerData(Log);
reportOption.ReportModel.DataSources.Clear();
reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "DataSet1", Value = objGetReportViewerData.ColumnReportReportData() });
}

public IList ColumnReportReportData()
{
DataTable dt = null;
MessageInfo objMsgInfo = new MessageInfo();
_data.RetrieveRecords(ref objMsgInfo, "SELECT ROW_NUMBER() OVER (ORDER BY ExtTbl.[INBOXSTATUS]) As [UNIQUESRL],ExtTbl. [INBOXSTATUS] As [XAxis], ISNULL(Count(ExtTbl.[INBOXREFNO]),0) As [YAxis] FROM [DX_Inbox_LOXF] AS ExtTbl WHERE ExtTbl.[INBOXSTATUS] IS NOT NULL AND ( ISNULL([INBOXSTATUS],'') <> 'Folder Created' ) GROUP BY ExtTbl.[INBOXSTATUS]", ref dt);
var list = dt.Rows.Cast().ToList();
return list;
}

Finally,

$(function () {
$("#container").ejReportViewer(
{
isResponsive: true ,
reportServiceUrl: '/api/SyncfusionReport',
processingMode: ej.ReportViewer.ProcessingMode.Local,
reportPath: '~/Reports/ColumnChartReport.rdl',
pageSettings: { orientation: ej.ReportViewer.Orientation.Landscape },
pageSettings: { paperSize: ej.ReportViewer.PaperSize.A4 },
//printMode: true,
//PrintOptions: ej.ReportViewer.PrintOptions.None,
reportPrint: "onReportPrint"
});
});

But when I run the application it not display the data.I have attached the rdlc file for your reference.

Many thanks.

Attachment: ColumnChartReport_aaeebc01.rar

1 Reply

YD Yuvaraj Devarajan Syncfusion Team September 7, 2017 05:39 AM UTC

Hi Prashant, 
 
Thanks for contacting Syncfusion support. 
 
We have checked the mentioned problem with the shared Report Definition by passing the local dataset value of the report in OnReportLoaded method and it’s working properly at our end as shown in shared screenshot. The mentioned problem might be occurred when the list of dataset value is not passed properly in ReportDataSource, so can you please check whether the list of dataset is passed properly from ColumnReportReportData method in your application.   
 
 
 
For your reference, we have prepared a sample and it can be downloaded from below location, 
 
If the issue still persists, then revert the shared sample with issue reproducible procedure to validate the mentioned problem at our end.  
 
Regards, 
Yuvaraj D. 


Loader.
Live Chat Icon For mobile
Up arrow icon