none
Report viewer not showing report RRS feed

  • Question

  • using Microsoft.Reporting.WebForms;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using SPCS.Models;
    namespace SPCS.Report
    {
        public partial class WebForm1 : System.Web.UI.Page
        { SPCSDBEntities1 objDb = new SPCSDBEntities1();
            
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    try
                    {
                      
                        var data1 = objDb.DepartmentMasters.ToList();
                        string appPath = HttpContext.Current.Request.ApplicationPath;
                        string physicalPath = HttpContext.Current.Request.MapPath(appPath);
                        ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"ALpCertificate.rdlc");
    
                        ReportDataSource rds1 = new ReportDataSource("DataSet1",data1);
    
                        ReportViewer1.LocalReport.DataSources.Clear();
                        ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", data1.ToList()));
                        ReportViewer1.DataBind();
                        ReportViewer1.LocalReport.Refresh();
    
                       
    
                    }
                    catch (Exception ex)
                    {
    
                        throw;
                    }
                }
            }
        }
    }
    <%@ Register assembly="Microsoft.ReportViewer.WebForms" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>







    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager> 
        </div>
            <rsweb:ReportViewer ID="ReportViewer1" runat="server">
            </rsweb:ReportViewer>
        </form>
    </body>
    </html>


    <title><br _moz_dirty="" /></title>

    <form id="form1" runat="server">
    <asp:scriptmanager id="ScriptManager1" runat="server"></asp:scriptmanager>
    <rsweb:reportviewer id="ReportViewer1" runat="server"></rsweb:reportviewer> </form>
    • Moved by CoolDadTx Monday, December 18, 2017 2:44 PM ASP.NET related
    Saturday, December 16, 2017 1:01 PM

All replies

  • Hi,

    Your question is related asp.net, it will be more appropriate to ask your question at asp.net Forum.

    Your understanding and cooperation will be grateful.

    Sincerely,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 18, 2017 8:48 AM