ObjectDataSource Outside the report?

2 posts, 0 answers
  1. Aubrey Ivan
    Aubrey Ivan avatar
    26 posts
    Member since:
    Oct 2019

    Posted 31 Oct 2019 Link to this post

    Hi Admin,

    Is it possible to pass the object datasource outside a report and then inside the constructor of the report there is a parameters for that datasource which will be used by the report? Is that possible using Type Resource Report? I am using asp .net MVC

    also is it possible to pass an object or data table inside the TypeReportSource parameter?

    something like this


            public ActionResult Index()

                var organisation = _organisationLogic.GetOrganisation();

                var typeReportSource = new TypeReportSource()
                    TypeName = typeof(OrganisationReportSample).AssemblyQualifiedName

                var sample = new Sample();
                var samples = new DataTable();
                samples = sample.GetReportData();

                typeReportSource.Parameters.Add(new Parameter("samples", samples));
                return View(typeReportSource);


    I am passing a data table inside the Report constructor and will use it like this..


            public OrganisationReportSample(DataTable samples)
                // Required for telerik Reporting designer support

                // TODO: Add any constructor code after InitializeComponent call
                this.DataSource = samples;



    is this possible or not?

  2. Todor
    Todor avatar
    451 posts

    Posted 04 Nov 2019 Link to this post

    Hello Aubrey Ivan,

    If you use TypeReportSource the report will be instantiated by the Reporting engine with System.Reflection, and it will use its parameterless constructor. Hence, if you want to use a Report that accepts a parameter in the constructor, you will need to instantiate it manually and return it wrapped in an InstanceReportSource. This should happen in a Custom Report Resolver.

    Please, check my reply to the Forum post you opened on a similar matter for more details - InstanceReportSource Not Working, Viewers says No Report

    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top