1

I am generating a report and trying to pass the parameter into this. I have two text text box where I want to insert the range and when i click on the download button it should download only the fields in that range (for e.g. download where rownumber is from 1 to 10):

my .aspx page

<asp:Panel ID="pnlReport" runat="server" Visible="false">
        <rsweb:ReportViewer ID="rptViewer" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" HyperlinkTarget="_blank">
            <LocalReport ReportPath="Reports/allAbstractByThemeRange.rdlc" ReportEmbeddedResource="RA.Reports.allAbstractByThemeRange.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="allAbstractByThemeRangeDS" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="allAbstractByThemeRangeDSTableAdapters.allAbstractByThemeRangeTableAdapter"></asp:ObjectDataSource>
        <asp:ObjectDataSource ID="odsAllAbstractByCategoryDS" runat="server" SelectMethod="GetData" TypeName="RA.Reports.allAbstractByThemeRangeDSTableAdapters.allAbstractByThemeRangeTableAdapter" OldValuesParameterFormatString="original_{0}"></asp:ObjectDataSource>
    </asp:Panel>

my source code:

ReportParameter rp1 = new ReportParameter("Parameter1", minRange.Text.ToString());
        ReportParameter rp2 = new ReportParameter("Parameter2", maxRange.Text.ToString());

        rptViewer.LocalReport.EnableHyperlinks = true;
        rptViewer.LocalReport.DataSources.Clear();
        getAllAbstractByThemeRangeDS();

        ReportDataSource datasource = new ReportDataSource("allAbstractByThemeRangeDS", dsResult.Tables[0]);

  /* here I am getting all the data , and in the dsResult I am able to fetch all the data, for e.g. all the records are getting stored into dsResult, now I want only 10 records from these all records. So I am trying to pass the parameter*/

        rptViewer.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2 });
        rptViewer.LocalReport.DataSources.Add(datasource);
        this.rptViewer.LocalReport.Refresh();

I am not sure how to write that code , and how to pass these parameter into .xsd file:

SELECT 
'' AS rowNumber,
'' AS title,
'' AS previewCategory,
'' AS previewTheme
Mohammad Shahbaz
  • 403
  • 8
  • 28
  • If you google search for "RDLC pass range parameters" you will get some helpful hits including from SO. http://stackoverflow.com/questions/27996831/how-to-set-parameter-values-in-rdlc which shows in detail how to pass date ranges into an RDLC, and you are trying to pass an Int range, so you should be able to adapt the code example shown. – PhillipH Dec 27 '16 at 15:59
  • 1
    why don't filter the results before to send it to the report? – McNets Dec 27 '16 at 16:09
  • how can we do that ? – Mohammad Shahbaz Dec 27 '16 at 17:31

0 Answers0