views:

15

answers:

1

Hi,

I might be asking a very basic question and I am sorry for that.

I have a web application which is sort of a reporting portal. I have a ReportViewer.aspx page which has the crystalreportviewer control on it, and i am using the same viewer to show different reports. The reports are made by someone else altogther so i just have a .rpt file which i have included in my project.

I am giving the report datasource dynamically so there is no static data binding.(passing the parameters dynamically as well)

The reports usually have more than one page.

The problem is when i move to the next page, there is a postback and it does all the databinding again.

If i save the reportdocument object in session and check IsPostback and just get it out of the session, it works fine.

The question is whether this is the correct way of doing it. coz if i open a new tab and see the same report i will end up losing my first report...(i could avoid this by doing some whacky session management like passing a guid in the querystring and then retrieving the correct report object) but still is this the right way?

any examples of how it is done would be really great...

Cheers,

Oz

A: 

Well, you keep the ReportDocument in session and bind it to the CrystalViewer if PostBack.

The important point though is to do it all in Page_Init instead of Page_Load otherwise multipage crystal reports will be stuck on page 2 when you click the next button...

Sheikh Usman