This is a migrated thread and some comments may be shown as answers.

No parameterless constructor defined for this object.

3 Answers 639 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
Abhay
Top achievements
Rank 1
Abhay asked on 28 Sep 2012, 09:12 AM

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
            //
            InitializeComponent();
            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?  

3 Answers, 1 is accepted

Sort by
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 02 Oct 2012, 07:58 AM
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. 
0
Abhay
Top achievements
Rank 1
answered on 02 Oct 2012, 09:22 AM
Can you please elaborate your answer..  How to serialized report? 
0
Elian
Telerik team
answered on 03 Oct 2012, 12:31 PM
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,
Elian
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!

Tags
Sharepoint Integration
Asked by
Abhay
Top achievements
Rank 1
Answers by
Hadib Ahmabi
Top achievements
Rank 1
Abhay
Top achievements
Rank 1
Elian
Telerik team
Share this question
or