Hello Telerik Team,
I'm find it difficult to pass a report parameter value from the client side and access the particular value within the Telerik report class.
cshtml code.
@{
TypeReportSource typeReportSource = new TypeReportSource() { TypeName = typeof(TestTelerik.Website.Reports.MySales).AssemblyQualifiedName };
typeReportSource.Parameters.Add("param", "A");
}
@(Html.TelerikReporting().ReportViewer()
.Id("reportViewer1")
.ServiceUrl(Url.Content("~/api/reports/"))
.TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate-9.1.15.624.html"))
.ReportSource(typeReportSource)
.ViewMode(ViewMode.Interactive)
.ScaleMode(ScaleMode.Specific)
.Scale(1.0)
.PersistSession(false)
.PrintMode(PrintMode.AutoSelect)
.Deferred()
I have defined a method to trigger NeedDataBind event which is as follows.
private void ProductReport_NeedDataSource(object sender, EventArgs e)
{
var myParam = this.ReportParameters["param"].Value.ToString();
}
Also i have defined report parameter as follows. However, this.ReportParameters["param"].Value is always null. Could I know what am I doing wrong in my code.
reportParameter1.Name = "param";
this.ReportParameters.Add(reportParameter1);