Solved

Reportviewer rdlc .net parameters

Posted on 2011-03-03
8
1,288 Views
Last Modified: 2013-11-26
1)I am adding paarmeters to reportviewer.

Code: 2 ways -both giving smae error
        private void setRepParam()
        {
            ReportParameter[] RptParameters = new Microsoft.Reporting.WinForms.ReportParameter[2];//declare the number of parameters
            string strTrxx = ddTrxx.SelectedItem.ToString();
            string strYear = ddYear.SelectedItem.ToString();
            RptParameters[0] = new Microsoft.Reporting.WinForms.ReportParameter("YEAR", strYear,false);// first parameter
            RptParameters[1] = new Microsoft.Reporting.WinForms.ReportParameter("TR_XX", strTrxx,false);//second parameter
            try
            {
            this.reportViewer1.LocalReport.SetParameters(RptParameters);
            this.reportViewer1.LocalReport.Refresh();
            this.reportViewer1.Show();
            this.reportViewer1.RefreshReport();
            }
            catch (Exception e)
            {
                throw (e);    
            }
          }
        private void SetReportParameters()
        {
            string strTrxx = ddTrxx.SelectedItem.ToString();
            string strYear = ddYear.SelectedItem.ToString();
           
            ReportParameter yearParameter = new ReportParameter("Year",strYear);
            ReportParameter trGrpParameter = new ReportParameter("Trade_Owner", strTrxx);
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { yearParameter, trGrpParameter });
        }
2)Did select rdlc report and add parameters to it through the builder.
3)But still --
If I add this --this.reportViewer1.LocalReport.Refresh(); no report appears
If I write --this reportViewer1.ReportRefresh()---original report appears without any filter based on parameter..
How do I make parameterized reports run ?????

0
Comment
Question by:rishaan
  • 4
  • 3
8 Comments
 
LVL 13

Assisted Solution

by:agarwalrahul
agarwalrahul earned 100 total points
ID: 35034184
0
 

Author Comment

by:rishaan
ID: 35069490
Thanks..I tries the 3 steps---
1)Creating report parameter in the rdlc report
2)Changed the Fields!XX.Value in textbox  to Parameters!xx.value ----in rdlc report
3)Added reportparamters to reportviweer.localreport.paarmeters.add(..) in .net code...
Now I can run report and see the results but the result is just replaced by that value eg. ASIA
Everwhere the fileds!XX value is is replaced by PArametr entered.
Its not actually filtering records...WHAT AM I Missing ???
0
 
LVL 5

Accepted Solution

by:
puffdaddy411 earned 150 total points
ID: 35072478
It sounds like you are attempting to filter a reportviewer table using your parameter.  You need to open the Table Properties dialog box and select the "Filters" tab.  Under "Expression", select the column on which you need to filter.  Select your desired operator.  Under "Value", your expression should look like "=Parameters!xx.value".

In your previous step #2, you need to revert that change.  Ensure "=Fields!XX.Value" is in your textbox.

If you are using a reportviewer List object, this will work the same using the list properties window / Filters tab.
0
 

Author Comment

by:rishaan
ID: 35074393
reportviewer table dialog bo x ?how to open ?

0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 5

Expert Comment

by:puffdaddy411
ID: 35074627
Select the entire table, right-click the table border, and select properties.
0
 

Author Comment

by:rishaan
ID: 35083155
GREAT!!!!!!!!!!!!!!!!!!!!!!!It works like   charm..................................................
0
 
LVL 5

Expert Comment

by:puffdaddy411
ID: 35083170
Very good!  =D
0
 

Author Closing Comment

by:rishaan
ID: 35083175
THANKS A LOT for the quick and perfect response..
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now