答案 0 :(得分:1)
您应该可以使用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属性中。