ReportViewer drillthrough in WebForms looking for .rdlc instead of .rdl in Local processing

I am creating a ASP.NET application for reporting. I have created the reports (.rdl) using the Report designer. I keep all these .rdl files in a folder and this reporting application will list these reports. Clicking on a report will generate the report. I am reading the rdl xml to get the query and query parameters, then retrieve the data and add datasource to the LocalReport. This is working fine. In the drillthrough event I get the original drillthrough parameters and retrieving the data and setting it to the drillthrouh report. But it the report is looking for the .rdlc file. Just for the time being I renamed the .rdl file to have the .rdlc extension and it works.

But the same aproach works fine with the Winforms ReportViewer control with .rdl files.

Need help to make it work. We are not embedding the reports in the application. We would like to make this application not having any knowledge about the reports it is going to process at design time. We would like to have the flexibility of adding new reports just by dropping the .rdl files in the folder.

Need help

 

Thanks!

 



Answer this question

ReportViewer drillthrough in WebForms looking for .rdlc instead of .rdl in Local processing

  • lex3001

    Hi,
    How you read the query and query parameter from the rdl xml file.. Do you have sample code I'm stuck here!

    Hope for your kind reply!


  • MetaDjinn

    Hi Raidu!

    thanks for ur instant reply. Now I got an idea to proceed further.

    If i have any queries further I will contact u in due course.

    Bye

    Raman



  • totof42

    Raman sv wrote:

    Hi Raidu

    This is Raman.

    I found u are reading the rdl xml to get the query and query parameters, then retrieve the data and add datasource to the LocalReport.

    I am about to do the same process for my report.

    Could u plz. help me by explaining the method to read xml in reportviewer control and also i will be happy if u send me the corresponding code.

    Awaiting for ur reply.

    Regards,

    Raman.



  • HuyN_MS

    Hi folks. I am doing something similar except I have a problem at the DataSet level.

    I have a list of reports, all with different dataset names and their reports are coming from different datasources. I created a generic reportviewer windows form that allows a user to select a report from a list of reports in the database. Each record of the database also stores some flags on whether they need to specify a from date, to date, select a month or select a year.

    The database also stores the RDLC file as a text datatype and the stored procedure name of the datasource to get the data. The idea was, allow the report viewer page to use a generic dataset to load the data from the stored datasource.

    The problem is, the dataset name is specified in the RDLC file. I would like to see an example of how I can parse the RDLC string field and replace the dataset name specified in the string with a generic dataset (dataset1).

    So far, I have just edited the RDLC file before it was placed in the database and everything else works great. Once this takes place, the page will be completely dynamic.

    Can either of you help me there

    Thank you!


  • Galb

    Hi Raidu-

    I am also working on the same problem - parsing dataset and parameters from rdl files to automate viewing an rdlc in ReportViewer. Could you send me your souce code so that I see how to do it I will send back any ideas or improvements that I think of.

    thanks

    Bert


  • Tom Servo

    Hi Raidu

    This is Raman.

    I found u are reading the rdl xml to get the query and query parameters, then retrieve the data and add datasource to the LocalReport.

    I am about to do the same process for my report.

    Could u plz. help me by explaining the method to read xml in reportviewer control and also i will be happy if u send me the corresponding code.

    Awaiting for ur reply.

    Regards,

    Raman.



  • Graham Hay

    This has turned out to be easy process once .rdl format is understood.

    Load the .rdl file into XMLDocument and parse the XML to get the DataSet name, CommandText and QueryParameters.

    Replace the QueryParameter name in the CommandText with the value of the QueryParameter and retrieve the data to the dataset. Then add this dataset to the localreport datasources and refresh the report.

    When you are using the local processing mode you have limited builtin functionality available. But the advantage of using this method is, you do not need to have the ReportServer licence and it is very flexible. The application does not need to know about the reports it is processing. You just need to let the application know where to look for the .rdl files. You can add additional reports by dropping the .rdl files in the folder and application will list the reports and process them too.

    We have developed an application where we list reports, selecting the report will bring up the Parameters page from the local report and accept the data for the parameters and then process the report.

    Hope this will help. Let me know if you need more info.


  • RAnderson14

    Raman,

    I would be more than happy to share my views or code on this issue. May be together we can improve it.

    Raidu


  • Senthil84

    You do not need to replace the dataset name in the RDLC.

    Parse the XML, get the SQL and parameters. Replace parameter names in the SQL with the Parameter values and retrieve the data to a generic dataset.

    Then add this data set to the Reportviewer datasources.

    string dataSetName = "";

    IList dataSourceList = (IList)this.ReportViewer1.LocalReport.GetDataSourceNames();

    for (int i = 0; i < dataSourceList.Count; i++)

    {

    dataSetName = dataSourceListIdea.ToString();

    break;

    }

    ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(dataSetName, LoadReportData()));

    ReportViewer1.LocalReport.Refresh();

    LoadReportData() method will retrieve the data to the dataset and return the Datatable of the dataset.


  • ReportViewer drillthrough in WebForms looking for .rdlc instead of .rdl in Local processing