locked
Webmatrix and Reportviewer RDL-reports RRS feed

  • Question

  • User-1322807808 posted

    Hello

    I am trying to use rdl - reports in local mode with Webmatrix,
    but what is missing in my code?
    Or how it should be done? Now
    only white screen appears ...
    Report works fine in Report Builder 3.0.

    thanks
    jus


    @using Microsoft.Reporting.WebForms;
    ...

    @{
        var dbName = "ykr.mdf";
        var sqlQuery = "SELECT * FROM tb1 WHERE ffto LIKE '001%' ";
        var datTable = CreateDataTable(sqlQuery);
        @datTable.Rows.Count; 
        ... // shows count > 1

        ReportViewer ReportViewer1 = new ReportViewer();
            ReportViewer1.ProcessingMode = ProcessingMode.Local;
            ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/report/m1.rdl");
            ReportDataSource datasource = new ReportDataSource("Datatbl1", datTable);
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(datasource);
            ReportViewer1.LocalReport.Refresh();
            ReportViewer1.Visible=true;      
    }
    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="utf-8" />
            <title></title>
        </head>
        <body>
    ...report  show appear  here
         <div id="Report" ></div>
        </body>
    </html>

    Friday, April 18, 2014 8:50 PM

Answers

  • User-821857111 posted

    Razor pages don't support the use of server controls. So the only way to the use the ReportViewer control (or any web forms control for that matter) is to add a .aspx file to your site. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 21, 2014 4:43 AM

All replies

  • User-821857111 posted

    Razor pages don't support the use of server controls. So the only way to the use the ReportViewer control (or any web forms control for that matter) is to add a .aspx file to your site. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 21, 2014 4:43 AM
  • User-1322807808 posted

    Thanks Mike!

    Could you please recommend any 

    free and light  reporting tool for Webmatrix?

    Mainly for quite simple reporting.

    thanks

    Tuesday, April 22, 2014 10:34 AM
  • User-821857111 posted

    I'm not familiar with any, sorry.

    Tuesday, April 22, 2014 11:08 AM
  • User-908601221 posted

    I have never seen a dedicated reporting tool for WebPages/Razor that compares to SSRS reports, but depending on your report requirements you can certainly create a report using plain old cshtml files mixed with a JavaScript graph/chart framework (or the built in asp.net charting library).

    Wednesday, April 23, 2014 3:42 PM