Skip to Content
author's profile photo Former Member
Former Member

Hi a subreport problem here...Some body plz give a soln. to it

Hi All,

I want to sort the sub reports in a main report programatically from c#.net.

I mean we have say 5 sub reports and programatically i want to call the 1st subreport at 4th position, 2nd at the first etc.

Let me know if i am not clear in making you understand my problem.

Or tell me how to access the crystal report sections in the c# codebehind.

I am using vs2010 with crystal reports.

Thanks

Madhav

Edited by: madhavkulkarni on Jul 8, 2011 8:38 AM

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jul 08, 2011 at 12:45 PM

    Can you please explain what you mean by:

    "i want to call the 1st subreport at 4th position, 2nd at the first etc"

    When you insert seubreports in the main report, you can place them in different sectionson report e.g. report\page header, report\page footer or details section. If the report is embedded, it will run and you will see it. If the report is on demand, you will see a hyperlink for the subreport, upon clicking the hyperlink you will see the report. Since report is rendered page by page basis, depends on where and how the subreports are placed in the main report will determine the order in which subreport data is fetched.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 08, 2011 at 01:42 PM

    Hi Madhav,

    Think of Crystal Reports as a book, Start with the first chapter ( Report Header ) and then move on to the Second chapter ( Page Header ) etc..... Where you place the subreports is where they get executed.

    I believe what you want to do is moved the subreport at runtime, can be done but with warnings, depends on how they are linked etc. Using RAS you can clone the subreport objects and then move then to any section and set the link back up again.

    It may work....

    Can you explain why you want to move them, which is the same thing as running them in a different order?

    I think what you need to do is go back to the Report Designer and add the subreports into each section and then set up suppression logic to suppress the one you don't want to run....

    You also may want to have a look at what you are trying to accomplish, there may be easier ways to do this rather than moving subreports around.

    Subreports will affect performance, if you can lay out your report, possibly using a Stored Procedure to collect/link the data that would be better than using subreports.

    Good luck

    Don

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.