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

No parameterless constructor defined for this object.

1 Answer 79 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Abhay
Top achievements
Rank 1
Abhay asked on 03 Oct 2012, 12:14 PM

 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?

1 Answer, 1 is accepted

Sort by
0
Chavdar
Telerik team
answered on 12 Oct 2012, 03:15 PM
Hi,

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 a 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.

For more info, please review the  Design Considerations for Out-proc Session State help article.


Kind regards,
Chavdar
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
General Discussions
Asked by
Abhay
Top achievements
Rank 1
Answers by
Chavdar
Telerik team
Share this question
or