none
Is it possible to use dependent combo boxes?

    Question

  •  

    Hi,

     

    I have a problem with a report.

     

    in this report 1 use 2 combo boxes. The first with my organisation on different levels.

     

    And in the second a value for every level and all.

     

    Now i want to filter the organisation box with the second combo box.

     

    For the first time it works but if i change after that the box it doesn't work.

     

    I use SQL Reporting Services 2005

    Thursday, November 15, 2007 11:46 AM

Answers

  • Hi,

     

    Glad to see your post. I think you want a cascading parameter in your report, right?

     

    Friday, November 16, 2007 7:10 AM

All replies

  • Hi,

     

    Glad to see your post. I think you want a cascading parameter in your report, right?

     

    Friday, November 16, 2007 7:10 AM
  • This is my intention, if this works in combo-Boxes

    Friday, November 16, 2007 8:33 AM
  • Hi,

             Here i am sending code (c#) related to your problem. I hope this will fulfill your need. Here i am taken 2 comboboxes one is for country names basing upon the country name list of states will be displayed in second combobox.



    using System;
    using System.Collections.Generic;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using Microsoft.Reporting.WinForms;

    namespace ServerReport
    {
        public partial class Form1 : Form
        {
            public SqlConnection con;
            public SqlCommand cmd;
            public SqlDataAdapter da;
            public DataSet ds,ds1;
            public Form1()
            {
                InitializeComponent();
               
            }

            private void Form1_Load(object sender, EventArgs e)
            {
                con = new SqlConnection("initial catalog=AdventureWorksDW; data source=localhost;integrated security=sspi;");
                cmd = new SqlCommand();
                da = new SqlDataAdapter();
                ds = new DataSet();
                ds1 = new DataSet();
                GetCountryName();
               

               
            }

            private void button1_Click(object sender, EventArgs e)
            {
               
                MyReportViewer.ShowParameterPrompts = false;
                MyReportViewer.ServerReport.ReportPath = "/ur report path from report server";
                ReportParameter[] param = new ReportParameter[2];
                param[0] = new ReportParameter("Country", comboBox1.Text);
                param[1] = new ReportParameter("State", comboBox2.Text);
                MyReportViewer.ServerReport.SetParameters(param);
                MyReportViewer.RefreshReport();
               

             
            }


          private void GetCountryName()
            {
                cmd.CommandText = "select Distinct(EnglishCountryRegionName) from DimGeography";
                cmd.Connection = con;
                da.SelectCommand = cmd;
                da.Fill(ds);
                comboBox1.Items.Clear();
                comboBox1.DataSource = ds.Tables[0];
                comboBox1.DisplayMember = "EnglishCountryRegionName";
            }


            private void GetStates()
            {
                cmd.CommandText = "select Distinct(StateProvinceName) from DimGeography where EnglishCountryRegionName='" + comboBox1.Text + "'";
                cmd.Connection = con;
                da.SelectCommand = cmd;
                da.Fill(ds1);
                comboBox2.DataSource = ds1.Tables[0];
                comboBox2.DisplayMember = "stateprovincename";
            }
          
            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                ds1.Clear();
                GetStates();
            }

      }
    }

    • Proposed as answer by Murty Addanki Tuesday, June 16, 2009 9:18 AM
    Tuesday, November 20, 2007 9:49 AM