【问题标题】:Telerik Reporting How to force the 'Contract' selection whether user selects it or notTelerik Reporting 无论用户是否选择,如何强制选择“合同”
【发布时间】:2018-07-27 17:33:56
【问题描述】:

无论用户是否从下拉列表中选择,我都想强制返回参数“Contract”。

【问题讨论】:

    标签: telerik-reporting multivalue reportparameter


    【解决方案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属性中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-26
      • 1970-01-01
      • 2019-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-12
      相关资源
      最近更新 更多