ReporViewer ASP.NET

Hi guys,

I have implemented reporting viewer in my solution and everything working perfectly.
I'm looking for a solution to how can I direct many reports to this reporting page:

For example:
I'm passing value to my C# code, look at the link code below.

 <a title="Inventory Count Parse" class="icon-bar-chart icon-2x" target="_blank" href="http://localhost:1863/ReportViewer.aspx?reference=@item.Reference"></a>

Open in new window



Then in my code it is written like that way:

 public partial class ReportViewer : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string rr = Request.QueryString["reference"];
            ShowReport(rr);
        }

        private void ShowReport(string rr)
        {
            try
            {
                //report url  
                string urlReportServer = "http://srv-db-01:8081/ReportServer";

                // ProcessingMode will be Either Remote or Local  
                ReportViewer1.ProcessingMode = ProcessingMode.Remote;

                //Set the ReportServer Url  
                ReportViewer1.ServerReport.ReportServerUrl = new Uri(urlReportServer);

                // setting report path  
                //Passing the Report Path with report name no need to add report extension   
                ReportViewer1.ServerReport.ReportPath = "/ERP/Parse Web App Inventory Count";
                ReportViewer1.ServerReport.ReportPath = "/ERP/Inv item Movement 90";

                //Set report Parameter  
                //Creating an ArrayList for combine the Parameters which will be passed into SSRS Report  
                ArrayList reportParam = new ArrayList();
                reportParam = ReportDefaultPatam(rr);

                ReportParameter[] param = new ReportParameter[reportParam.Count];
                for (int k = 0; k < reportParam.Count; k++)
                {
                    param[k] = (ReportParameter)reportParam[k];
                }  

                //pass credential as if any... no need to pass anything if we use windows authentication  
                IReportServerCredentials irc = new CustomReportCredentials("dddd", "dddd", "ddd.dd");
                ReportViewer1.ServerReport.ReportServerCredentials = irc;


                //pass parameters to report  
                ReportViewer1.ServerReport.SetParameters(param);   
                ReportViewer1.ServerReport.Refresh();
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
       
        private ArrayList ReportDefaultPatam(string rr)
        {
            ArrayList arrLstDefaultParam = new ArrayList();
            arrLstDefaultParam.Add(CreateReportParameter("reference", rr));
            arrLstDefaultParam.Add(CreateReportParameter("ilc", rr));
            //arrLstDefaultParam.Add(CreateReportParameter("ReportSubTitle", "Sub Title of Report"));
            return arrLstDefaultParam;
        }

Open in new window


As you see below c# code I added another report path and I linked it with other link through the view.

Here is my question: How can I pass dynamic path from the view as I have many other reports and the path change for each report.

Please, let me know if there is any other way to do it.

Thank,
LVL 1
Moti Mashiah.NET DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
It looks like you are passing in a query string argument for the report, but hard-coding the path here:

       ReportViewer1.ServerReport.ReportPath = "/ERP/Parse Web App Inventory Count";
       ReportViewer1.ServerReport.ReportPath = "/ERP/Inv item Movement 90";

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Moti Mashiah.NET DeveloperAuthor Commented:
Thank
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.