none
Interactive Sort Causes Dropdown List to Disappear RRS feed

  • Question

  • I created a local rdlc report and a web page using ASP and C#.  My web page has a dropdown list at the top that allows the user to change the report displayed.  There is a reportviewer control underneath.  When I click on one of  the Interactive Sort icons within the report, the list box at the top of the report disappears and the report control occupies the full page.  I'm using Reporting Services v9.00.3054.00.

    Can anyone tell me what is going wrong?

    Thanks,
    Ridium

    Here is my code:
    public partial class _Default : System.Web.UI.Page
    {
        void Page_Init()
        {
            ddlDate.DataBind();
            ddlDate.SelectedIndex = 0;      //choose first item in dropdown listbox
        }

        protected void Page_Load(object sender, EventArgs e)
        {
          
            //declare connection string
            string cnString = @"Data Source=Alcatraz;Initial Catalog=Quantnet; Integrated Security=YES";

            //declare Connection, command and other related objects
            ReportViewer1.Reset();
            SqlConnection conReport = new SqlConnection(cnString);
            SqlCommand cmdReport = new SqlCommand();
            SqlDataReader drReport;
            DataSet dsReport = new dsR1000();

            //declare form objects
           
            try
            {
                //prepare report data source
                ReportDataSource rds = new ReportDataSource();
               
                //open connection
                conReport.Open();

                //prepare connection object to get the data through reader and populate into dataset
                cmdReport.CommandType = CommandType.Text;
                cmdReport.Connection = conReport;

                //determine the model table
                string strModel = "R1DMODELOPT";
                string strReport = "R1000Standard.rdlc";
               
                switch (ddlModel.SelectedValue)
                {
                    case "R1000":
                        strModel = "R1DMODELOPT";    //report SQL table
                        dsReport = new dsR1000();       //report dataset
                        rds.Name = "dsR1000_dtR1000";   //report output datasources
                        switch (ddlType.SelectedItem.Text)
                        {
                            case "Standard":
                                strReport = "R1000Standard.rdlc";
                                break;
                            case "Sector":
                                strReport = "R1000Sector.rdlc";
                                break;
                        }
                        break;
                    case "RMG":
                        strModel = "RMGDMODELOPT";     //report SQL table
                        dsReport = new dsRMG();         //report dataset
                        rds.Name = "dsRMG_dtRMG";       //report output datasources
                        switch (ddlType.SelectedItem.Text)
                        {
                            case "Standard":
                                strReport = "RMGStandard.rdlc";
                                break;
                            case "Sector":
                                strReport = "RMGSector.rdlc";
                                break;
                        }
                        break;
                }

                cmdReport.CommandText = "Select * FROM " + strModel + " WHERE DATE = '" + ddlDate.SelectedItem.Text + "'";

                //read data from command object
                drReport = cmdReport.ExecuteReader();

                //new cool thing with ADO.NET... load data directly from reader to dataset
                dsReport.Tables[0].Load(drReport);

                //close reader and connection
                drReport.Close();
                conReport.Close();

                //provide local report information to viewer
                ReportViewer1.LocalReport.ReportPath = Server.MapPath(strReport);
               
                rds.Value = dsReport.Tables[0];
                ReportViewer1.LocalReport.DataSources.Add(rds);
                ReportViewer1.LocalReport.Refresh();
            }
            catch (InvalidCastException ex)
            {
                //routine to handle error
            }
            finally
            {
                //check if connection is still open then attempt to close it
                if (conReport.State == ConnectionState.Open)
                {
                    conReport.Close();
                }
            }
        }
    }
    Friday, July 6, 2007 12:46 AM

All replies

  • It looks like hitting the Interactive Sort causes the ReportViewer control to render but not the rest of the web page.  So the page just shows the ReportViewer control and nothing else.  I'm very new to ASP so I'm not sure how I get the rest of the web page to render after an Interactive Sort icon is pressed.  Can anyone help me out with this?

    Thanks,
    Ridium
    Monday, July 9, 2007 6:48 PM