TechSapphire Tuesday, 2024-05-21, 3:18 AM
Site menu
Login form
Play Games
  • Deep Freeze
  • Ice Slide
  • Gyroball
  • Fat Fish
  • Bush Royal Rampage
  • Error: Subreport could not be shown. RDLC using with ASP.NET.

    This exception is thrown only in 3 cases:
    1. Parameter is not passed to sub report
    2. Parameter which is been passed is not been created on sub report
    3. Data type of parameter on main report and sub report is not matching up.

    C# code which is required to display sub report is mentioned below:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Microsoft.Reporting.WebForms;
    public partial class ReportForm : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            if (!IsPostBack)
                ObjectDataSource obj = new ObjectDataSource();
                obj.TypeName = "NorthWindDataSetTableAdapters.CustomersTableAdapter";
                obj.SelectMethod = "GetData";
                ReportViewer1.LocalReport.ReportPath = "Report.rdlc";
                ReportDataSource objSource=new ReportDataSource("DataSet1",obj);
                ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(localReport_SubreportProcessing);
        void localReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
            ObjectDataSource obj = new ObjectDataSource();
            obj.TypeName = "NorthWindDataSetTableAdapters.OrdersTableAdapter";
            obj.SelectMethod = "GetData";
            obj.SelectParameters.Add("CustomerID", e.Parameters["CustomerID"].Values.First());
            ReportDataSource objSource = new ReportDataSource("DataSet1", obj);

    To download project click here.

    Programming [27]
    Tips for programming
    Security [2]
    Security Tips
    Google [1]
    Use google faster then ever you use
    Project [14]
    HTML [2]
    Electronics [0]
    Data Structure [0]
    Database [16]
    SSRS [1]
    Sql Server Reporting Services
    Copyright MyCorp © 2024