【发布时间】:2018-07-27 17:33:56
【问题描述】:
【问题讨论】:
标签: telerik-reporting multivalue reportparameter
【问题讨论】:
标签: telerik-reporting multivalue reportparameter
您应该能够为此使用NeedDataSource 事件。在这里查看它的文档:https://docs.telerik.com/reporting/designing-reports-parameters-programmatic-control
特别注意这个代码示例:
private void Report1_NeedDataSource(object sender, System.EventArgs e)
{
//Take the Telerik.Reporting.Processing.Report instance
Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
// Transfer the value of the processing instance of ReportParameter
// to the parameter value of the sqlDataSource component
// THIS IS WHERE YOU CAN FIND YOUR PARAMETER AND MODIFY ITS VALUE
this.sqlDataSource1.Parameters[0].Value = report.Parameters["ManagerID"].Value;
// Set the SqlDataSource component as it's DataSource
report.DataSource = this.sqlDataSource1;
}
由于您的参数是多值的,您需要创建一个IEnumerable。然后您可以将用户选择的参数值添加到IEnumerable。然后检查用户是否选择了"Contract",如果没有,则将其添加到列表中。最后将IEnumerable添加到数据源参数的value属性中。
【讨论】: