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
//
}
if (!this.IsPostBack)
{
InstanceReportSource reportSource = new InstanceReportSource
{ ReportDocument = new RptVersionHistory(this.DataTable) };
this.ReportViewer1.ReportSource = reportSource;
}
For testing, I have a pie chart with 8 items. The YValue of the item will be set in the NeedDataSource event. Since I am using the Telerik skin, the first item is green, second is yellow, third is red, and so on. I need to have these color consistent since I will be referencing the color elswhere on the report.
Item1 = green
Item2 = yellow
Item3 = red
Item4 = blue
If I add only the items that have non-zero value the color will not be consistent. For example, Item2 is zero then if I add Item1 then Item3:
Item1 = green
Item3 = yellow
Item4 = red
Item5 = blue
I need to make some of the items invisible. However, setting Visible = false does NOT hide the item. Suggestion?
I also tried the Remove() method but I get "An eroor occured while processing Chart... Object reference not set to an instance of an object."
foreach (ChartSeriesItem i in responseSeries.Items)
{
...
if (i.YValue == 0)
{
i.Visible = false;
}
...
}
var thisDataSet = SqlHelper.ExecuteDataset (
"Data Source=localhost;Initial Catalog=QmanagerDEV;User ID=sa;Password=secret"
, CommandType.StoredProcedure,
"spQtask_SelectTaskBySimpleSearchToReport"
, SqlParameterList (
true
).ToArray () );
var objectDataSource =
new
Telerik.Reporting.ObjectDataSource();
objectDataSource.DataSource = thisDataSet;
Telerik.Reporting.Report report =
new
Report();
report.DataSource = objectDataSource;
Telerik.Reporting.InstanceReportSource reportSource =
new
InstanceReportSource();
reportSource.ReportDocument = report;
ReportViewer1.ReportSource = reportSource;
ReportViewer1.RefreshReport ();