No parameterless constructor defined for this object.

4 posts, 0 answers
  1. Abhay
    Abhay avatar
    4 posts
    Member since:
    Aug 2012

    Posted 28 Sep 2012 Link to this post

    We are getting Error

    No parameterless constructor defined for this object. at Telerik.ReportViewer.WebForms.SerializableReportInfo.GetReport()

    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
    at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
    at System.Activator.CreateInstance(Type type, Boolean nonPublic)
    at Telerik.ReportViewer.WebForms.SerializableReportInfo.GetReport()
    at Telerik.ReportViewer.WebForms.SerializableReportDocument.GetDeserializedReport()
    at Telerik.ReportViewer.WebForms.SerializableReportSourceWrapper.get_ReportSource()
    at Telerik.ReportViewer.WebForms.ParametersPage.get_ReportDocument()
    at Telerik.ReportViewer.WebForms.ParametersPage.get_ParamsManager()
    at Telerik.ReportViewer.WebForms.ParametersPage.CreateChildControls()
    at System.Web.UI.Control.EnsureChildControls()
    at Telerik.ReportViewer.WebForms.ParametersPage.OnPreLoad(EventArgs e)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Binding datatable  to telerik:ReportViewer

    using Telerik.Reporting;
        /// <summary>
        /// Summary description for VersionHistory.
        /// </summary>
        public partial class RptVersionHistory : Report
            public RptVersionHistory(DataTable dtable )
                // Required for telerik Reporting designer support
                this.textBox8.Name = "Title";
                this.textBox2.Name = "Version";
                this.textBox3.Name = "Created By";
                this.textBox7.Name = "Created Date";
                this.textBox5.Name = "Modified By";
                this.textBox4.Name = "Modified Date";
                this.textBox1.Name = "Title";
                this.DataSource = dtable;
                // TODO: Add any constructor code after InitializeComponent call

    In sharepoint application page  in Page_Load calling as.. 

    if (!this.IsPostBack)
                      InstanceReportSource reportSource = new InstanceReportSource
                          { ReportDocument = new RptVersionHistory(this.DataTable) };
                      this.ReportViewer1.ReportSource = reportSource;

    It’s working fine in Dev. Server but not on production it showing above error anyone knows how to find out error?  

  2. Hadib Ahmabi
    Hadib Ahmabi avatar
    181 posts
    Member since:
    Nov 2011

    Posted 02 Oct 2012 Link to this post

    When working in out-proc session, the report is serialized / deserialized and it must have a constructor without parameters. To pass data to the report use either the provided DataSource components or NeedDataSource event. 
  3. Abhay
    Abhay avatar
    4 posts
    Member since:
    Aug 2012

    Posted 02 Oct 2012 Link to this post

    Can you please elaborate your answer..  How to serialized report? 
  4. Elian
    Elian avatar
    435 posts

    Posted 03 Oct 2012 Link to this post

    Hello Abhay,

    When working in out-proc session, the objects need to be serialized and deserialized, since they are not kept in memory. The XML serialization demands the objects to have parameterless constructor and this is why you need one. You do not need to explicitly do anything for the serialization - this is just the way it works when in out-proc session. 
    More info: Design Considerations for Out-proc Session State.
    Kind regards,
    the Telerik team

    HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

Back to Top