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

Cascading parameters disappear in Visual Studio 2010

2 Answers 60 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
yana roze
Top achievements
Rank 1
yana roze asked on 27 Oct 2010, 11:18 AM
Hi there,

I'm adding cascading parameters programmaticaly and code works fine in Visual Studio 2008 ( Q2 2009 SP1, WebForms.ReportViewer), but in 2010 all parameters disappear when value of main parameter is choosed.

How can I make it work?
Cheers,
Yana

private void addParameters()
        {
            // Create prm Bearer
            Telerik.Reporting.ReportParameter Bearer = new Telerik.Reporting.ReportParameter();

            Bearer.Name = "Bearer";
            Bearer.Type = Telerik.Reporting.ReportParameterType.Integer;
            Bearer.UI.Visible = true;

            Bearer.UI.AvailableValues.DataSource = new int[] { 1, 2, 3, 4 };
            Bearer.UI.AvailableValues.ValueMember = "Item";
            Bearer.Value = 0;

            // Create prm Metric
            Telerik.Reporting.ReportParameter Metrix = new Telerik.Reporting.ReportParameter();
            Metrix.Name = "Metrix";
            Metrix.Type = Telerik.Reporting.ReportParameterType.Integer;

            Metrix.UI.AvailableValues.DataSource = new int[] { 1, 111, 1111, 2, 22, 222, 2222, 3 };
            Metrix.UI.AvailableValues.ValueMember = "Item";
            Metrix.UI.Visible = true;

            string filterExpression = Metrix.UI.AvailableValues.ValueMember;
            Metrix.UI.AvailableValues.Filters.Add(
            "=" + filterExpression, Telerik.Reporting.Data.FilterOperator.In, "=GetBearer(Parameters.Bearer)");

            this.ReportParameters.Add(Bearer);
            this.ReportParameters.Add(Metrix);
        }
        public static int[] GetBearer(int bearer)
        {
            switch (bearer)
            {
                case 1:
                    return new int[] { 1, 11, 111, 1111 };    
                case 2:
                    return new int[] { 2, 22, 222, 2222 };
                default:
                    return new int[] {};

            }
        }

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 01 Nov 2010, 05:57 PM
Hello yana roze,

We have made some changes to the Report Parameters in Q1 2010:

  • CHANGE: Telerik.Reporting.Processing.Report.Parameters collection now contains Parameter objects instead of parameters' values
  • CHANGE: Telerik.Reporting.ReportParameter.UI property is now OBSOLETE
Thus I have modified your code, check out the following code snippet:

private void addParameters()
{
    Telerik.Reporting.ReportParameter Bearer = new Telerik.Reporting.ReportParameter();
    Telerik.Reporting.ReportParameter Metrix = new Telerik.Reporting.ReportParameter();
    Bearer.AvailableValues.DataSource = new int[] { 1, 2, 3, 4 };
    Bearer.AvailableValues.DisplayMember = "= Fields.Item";
    Bearer.AvailableValues.ValueMember = "= Fields.Item";
    Bearer.Name = "Bearer";
    Bearer.Type = Telerik.Reporting.ReportParameterType.Integer;
    Bearer.Visible = true;
    Metrix.AvailableValues.DataSource = new int[] { 1, 111, 1111, 2, 22, 222, 2222, 3 };
    Metrix.AvailableValues.DisplayMember = "= Fields.Item";
    Metrix.AvailableValues.Filters.AddRange(new Telerik.Reporting.Data.Filter[] {
    new Telerik.Reporting.Data.Filter("=Fields.Item", Telerik.Reporting.Data.FilterOperator.In, "= GetBearer(Parameters.Bearer.Value)")});
    Metrix.AvailableValues.ValueMember = "= Fields.Item";
    Metrix.Name = "Metrix";
    Metrix.Type = Telerik.Reporting.ReportParameterType.Integer;
    Metrix.Visible = true;
    this.ReportParameters.Add(Bearer);
    this.ReportParameters.Add(Metrix);
 
}
public static int[] GetBearer(object bearer)
{
    switch (Convert.ToInt32(bearer))
    {
        case 1:
            return new int[] { 1, 11, 111, 1111 };
        case 2:
            return new int[] { 2, 22, 222, 2222 };
        default:
            return new int[] { };
 
    }
}

Best wishes,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
yana roze
Top achievements
Rank 1
answered on 01 Nov 2010, 06:41 PM
Thanks, I will upgrade my version (I should start from that obviously).
Tags
General Discussions
Asked by
yana roze
Top achievements
Rank 1
Answers by
Peter
Telerik team
yana roze
Top achievements
Rank 1
Share this question
or