Help in understanding reports RRS feed

  • Question

  • Visual Studio 2008 / SQL 2008

    Currently I have been using a third party reports control in my aspx page. I have been looking into using the VS reports control but seem to be failing at the simplest of tasks.

    In my 'test' project i have a form with a reportviewer control. Using this control i created a simple report.

        <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
          Font-Size="8pt" Height="400px" Width="400px">
          <LocalReport ReportPath="Report1.rdlc">
              <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" 
                Name="TESTDataSet_tbCBMTranSetReport" />
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 

    The GetData method returns all records in the table.  What I want to do is filter this by the LedgerRef field to only display the one record I want.

    I have tried several things and searched loads of web pages, but the concept is escaping me . What I would like to do is set a parameter in code behind . I have looked through a few tutorials but to no avail. Can some one explin how to do this in laymans terms





    Dont ask me .. i dont know
    Monday, May 3, 2010 2:30 PM


  • Hi Ta. here's a stab. I may need some clarification from you.

    1. I assume you are displaying your report correctly without filters. Let me know if this is not the case.
    2. I assume you have a tablix (table or matrix) in your report.
    3. If you're trying to change the records returned by GetData, you'll have to do it in your table adapter. That can't be accomplished by the reportviewer control in local processing mode (which is your case), and setting a report parameter won't help here.
    4. If you're trying to filter the data displayed in the report based on the your data table that contains all the records, then go to the Filters tab in the Tablix Properties dialog, then click Add. Select your [LedgerRef] field in the Expression box, then specify the reference number you want in the Value box. Test that this works first by running your page before trying to set to a report parameter.
    5. To set the filter to a report parameter that's configured in your report, click Fx next to the Value box. In the Expression dialog, in the Category pane, select Parameters. Then, double-click the parameter you want in the Values pane, then click OK. This will produce an expression that looks like:


    6. To pass the parameter value to the report at run time, use the ReportViewer.LocalReport.SetParameters() method in your code behind.

    Cephas Lin This posting is provided "AS IS" with no warranties.
    • Marked as answer by Pete Newman Tuesday, December 13, 2011 8:51 AM
    Tuesday, May 4, 2010 1:43 PM