locked
How to display data in ReportViewer using aspx page in MVC project? RRS feed

  • Question

  • User1804735465 posted

    I'm using ReportViewer control for the first time and got an issue. I added aspx page to my MVC project:

    <script runat="server">
    
        protected void Page_Load(object sender, EventArgs e)
        {
            AbstractModel.UnitOfWork _unitOfWork = (AbstractModel.UnitOfWork)System.Web.HttpContext.Current.Items["uow"];
    
            IEnumerable data = _unitOfWork.VisitsReportRepo.GetData("01.01.2001", "10.09.2013", "0286");
    
            if (!Page.IsPostBack)
            {
                LocalReport localReport = ReportViewer1.LocalReport;
    
                ReportDataSource ds2 = new ReportDataSource("VisitReportDataSet", data);
                localReport.DataSources.Add(ds2);
    
            }
    
        }
    </script>
    <html>
    <head runat="server">
    </head>
    <body>
    <form runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
                Font-Size="8pt" InteractiveDeviceInfos="(Коллекция)"
                WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt"
                >
                <LocalReport ReportPath = "Views\Reports\Report039y.rdlc">
    
                </LocalReport>
            </rsweb:ReportViewer>
    
        </div>
        </form>
    </body>

    The problem is that my ReportViewer do not display any data, however localReport

     accepts the DataSource and contains all the data i need. VisitReportDataSet is my DataSet and ReportViewer has ReportPath to my rdlc

     report. What am I doing wrong? I'll appreciate any help!

    Tuesday, September 10, 2013 7:29 AM

All replies