Hi,
Couple of issues.
I installed reporting using and upgraded the project using the wizard.
When I try to open a report in design mode I get the problem shown in capture2.jpg which is trying to find a prior versioned dll.
Also one of reports has parameters that the viewer prompts for at runtime. the report will take the parameter but the following code that has always run in the past no longer runs:
private
void
RptADASummary_ItemDataBinding(
object
sender, EventArgs e)
{
if
(txtStartDate.Value ==
string
.Empty)
{
SchoolMonth _schoolMonth = SchoolMonthService.GetByID(Int32.Parse(
this
.ReportParameters[
"SchoolMonthID"
].Value.ToString()));
txtMonthNumber.Value = _schoolMonth.SchoolMonthNumber.ToString();
txtStartDate.Value = _schoolMonth.StartDate.ToShortDateString();
txtEndDate.Value = _schoolMonth.EndDate.ToShortDateString();
}
}
specifically it says the "this
.ReportParameters[
"SchoolMonthID"
].Value" is null. This code has always compliled and run fine until the most recent upgrade. has anything changed how one can access parameters in the report? If I take out the contents of this function, the report runs fine but is missing the text boxes. see capture1.jpg
Thanks,
Jonathan
6 Answers, 1 is accepted
The recommended approach to access the report parameters processing values in events is shown in the following code snippet:
private
void
RptADASummary_ItemDataBinding(
object
sender, EventArgs e)
{
if
(txtStartDate.Value ==
string
.Empty)
{
var report=(sender
as
Telerik.Reporting.Processing.Report);
SchoolMonth _schoolMonth = SchoolMonthService.GetByID(Int32.Parse(report.Parameters[
"SchoolMonthID"
].Value.ToString()));
txtMonthNumber.Value = _schoolMonth.SchoolMonthNumber.ToString();
txtStartDate.Value = _schoolMonth.StartDate.ToShortDateString();
txtEndDate.Value = _schoolMonth.EndDate.ToShortDateString();
}
}
You may find useful the Using Report Parameters programmatically help article. Greetings,
Peter
the Telerik team
HAPPY WITH 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!
Up to design time question, the upgrade wizard should handle all of the Telerik.Reporting version dependencies. If you have go through the upgrade wizard, our suggestion is to close all designers and rebuild the project. Additionally check out the report's resource files for version dependent records.
If you still experience difficulties with the design mode we will appreciate if you send us the problematic report definitions in a support thread to review on our end.
Peter
the Telerik team
HAPPY WITH 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!
all is well thanks!
silverlight B A
we have the same problem but in case sent parameter from page :
the code in page
void ReportViewer1_RenderBegin(object sender, Telerik.ReportViewer.Silverlight.RenderBeginEventArgs args)
{
if (args.ParameterValues.Count == 0)
{
args.ParameterValues.Add("PDocumentNo",documentId);
args.ParameterValues.Add("PDocumentActionDate", dateAction);
args.ParameterValues.Add("PDocumentType",cboDocumentTypeId);
args.ParameterValues.Add("PDocumentClassification", cboDocumentClassificationId);
args.ParameterValues.Add("PDocumentTitle", documentTitel);
args.ParameterValues.Add("PDocumentImportance", cboDocumentImportanceId);
args.ParameterValues.Add("PForeignCorrespondent", cboForeignCorrespondentId);
args.ParameterValues.Add("PDocumentFrom", dateFrom);
args.ParameterValues.Add("PDocumentTo", dateTo);
args.ParameterValues.Add("Pshipment", Shipment);
}
}
code in report
if (this.ReportParameters["PDocumentType"].Value.ToString() !="0")// error in step it sayed Object reference not set to an instance of an object.
{
if (x == 0)
{
sqlWhere += " where (Document.DocumentType=" + Convert.ToInt16(this.ReportParameters["PDocumentType"].Value) + ")";
x = 1;
}
var report=(sender
as
Telerik.Reporting.Processing.Report);