locked
crystal report generation using C#

    Question

  • Hi,

    I have to create a crystal report using 'pull' method in C#. I will have 3 dropdowns in my ASP page, based on the values of the 3 dropdowns i need to generate a crystal report. Suppose, i have one dropdown for 'country', one dropdown for 'region' and the other for 'salary'. now i need to get a report of all the employees in thar particular country, region and with that much salary.

    How can i do this?

    Monday, April 28, 2008 5:32 AM

Answers

  • What you can do is pass the report parameters from the DDL's in your page. Create three parameter fields for country, region, and salary in the report. Then you tell your report to select its data from the DB based on these three fields in the report's select expert. You can pass the values from your page to the report by using the ReportSource that you have bound to the ReportViewer. Here is what your ReportSource might look like

     

    <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">

    <Report FileName="EmployeeRpt.rpt">

    <Parameters>

    <CR:ControlParameter ControlID="CountryDDL" Name="Country" PropertyName="SelectedItem" />

    <CR:ControlParameter ControlID="RegionDDL" Name="Region" PropertyName="SelectedItem" />

    <CR:ControlParameter ControlID="SalaryDDL" Name="Salary" PropertyName="SelectedItem" />

    </Parameters>

    </Report>

    </CR:CrystalReportSource>

     

    hope this  helps

    Monday, April 28, 2008 6:09 PM