This is a migrated thread and some comments may be shown as answers.

help passing mutiple values for parameter

1 Answer 301 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ethan
Top achievements
Rank 1
ethan asked on 30 Jan 2011, 04:18 AM
Hi! I have the following code, but i cant get the muliple values in parameter multi value select to be passed in. What is the correct way to pass an an integer array to my method? Thankx.  Below is the code: the method GetManyCustomers takes in int[] .I also put this code in the report constructor.
CustomerFactory f = new CustomerFactory();
              Telerik.Reporting.ReportParameter param1 = new Telerik.Reporting.ReportParameter();
              param1.Name = "CustomerName";
              param1.Type = Telerik.Reporting.ReportParameterType.Integer;
              param1.AllowBlank = false;
              param1.Text = "FirstName";
              param1.Visible = true;
              param1.MultiValue = true;
              param1.AvailableValues.DataSource = f.GetCustomerNames();
              param1.AvailableValues.ValueMember = "=Fields.CustomerID";
              param1.Value = 0;
              this.ReportParameters.Add(param1);
              this.DataSource = f.GetManyCustomers(new int[] { Int32.Parse("=Parameters.CustomerName.Value") });

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 01 Feb 2011, 05:50 PM
Hello ethan,

Generally for configuring the Report's Parameter collection our suggestion is to use the Report Designer and ReportParameter Collection Editor. However if this is not applicable for you scenario, check out the following code snippet. The ReportParameterAvailableValues.DataSource Property accepts any Object but still the suggested approach is to use our DataSource Components.

public Report1()
{
    //
    // Required for telerik Reporting designer support
    //
    InitializeComponent();
 
    Telerik.Reporting.ReportParameter param1 = new Telerik.Reporting.ReportParameter();
    param1.Name = "CustomerName";
    param1.AvailableValues.DataSource = new object[] { 1,2,3 };
    param1.AvailableValues.ValueMember = "=Fields.Item";
    param1.Type = Telerik.Reporting.ReportParameterType.Integer;
    param1.AllowBlank = false;
    param1.Text = "FirstName";
    param1.Visible = true;
    param1.MultiValue = true;
    this.ReportParameters.Add(param1);
}

Regards,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
Tags
General Discussions
Asked by
ethan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or