Hi,
I'm trying to create a report programatically in C# using ObjectDataSource.
I've added a report parameter to the Report, and the parameter bar shows up on the right hand side.
I'm trying to pass the parameter from the report filer to my GetData class when the user clicks on "Preview" button. Can someone please help?
We first used the VS Telerik reporting wizard to create a Table report.
this.RLDS.DataMember = "GetData";
this.RLDS.DataSource = typeof(Test.TelerikReportLibrary.GenericTableDataSource);
this.RLDS.Parameters.Add(
new Telerik.Reporting.ObjectDataSourceParameter("location", typeof(string), null));
namespace Test.TelerikReportLibrary
{
[DataObject]
public class GenericTableDataSource
{
[DataObjectMethod(DataObjectMethodType.Select)]
public static List<
AssetReportLine
> GetData(string location) {
var resultAssetList = new List<
AssetReportLine
>();
// Get data from database
return resultAssetList;
}
}
}
We tried to add a parameter so that it displays on the right hand side of the report.
var reportParameter1 =
new
Telerik.Reporting.ReportParameter();
reportParameter1.Name =
"location"
;
reportParameter1.Text =
"Enter Value for Parameter1"
;
reportParameter1.Type = Telerik.Reporting.ReportParameterType.Integer;
reportParameter1.AllowBlank =
false
;
reportParameter1.AllowNull =
false
;
reportParameter1.Value =
"=10"
;
reportParameter1.Visible =
true
;
this
.Report.ReportParameters.Add(reportParameter1);