Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Can't use toolbar-param form reappears on refresh Post Reply Post New Topic
Author Message
foremost
Newbie
Newbie
Avatar

Joined: 03 Dec 2009
Location: Canada
Online Status: Offline
Posts: 2
Quote foremost Replybullet Topic: Can't use toolbar-param form reappears on refresh
     Posted: 03 Dec 2009 at 2:20pm
Hello all, hoping one of you can help me out here. I've searched and searched and tried a combination of things including storing the report document in a session variable and disabling the parameter prompt after postback; and ReuseParameterValuesOnRefresh doesn't seem to work.
 
Anyways...
 
We have various document libraries in a sharepoint portal that contains our report rpt files and we use an external web app to view reports in the libraries.
 
The app consists of one Default.aspx page containing the CrystalReportViewer control and a label control.
 
The parameters are set in the rpt file and if any and the report viewer will prompt the user for them.
 
The problem is that whenever we try to navigate, export, print, basically use any function of the toolbar, the page of course refreshes and goes back to the parameter input form.
 
What i'd like is for the data to persist without seeing the parameter input form.
 
Thanks,
 
Santosh
IP IP Logged
foremost
Newbie
Newbie
Avatar

Joined: 03 Dec 2009
Location: Canada
Online Status: Offline
Posts: 2
Quote foremost Replybullet Posted: 04 Dec 2009 at 9:11am
Ok here's what I did:
  1. Saved the report document into a session variable and load it back in after postback but;
  2. Disabled the parameter prompt on postbacks.
  3. To fix the paging issue, I had to move the code from the Page_Load to the Page_Init (found the solution here: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2709)

        protected void Page_Init(object sender, EventArgs e)
        {
            // Exit if the session variable containing the report document is null (or does not exist).
            if (null == Session["ReportDocument"]) return;

            // Set the Crystal Report Viewer source to our previously saved report document.
            var crdoc = (ReportDocument)Session["ReportDocument"];
            crViewer.ReportSource = crdoc;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            // We only want to see the parameter form on the initial page load.
            crViewer.EnableParameterPrompt = !IsPostBack;

            // We only want to continue on postback and if the session variable containing
            // the report document is not null (exists).
            if (IsPostBack && null != Session["ReportDocument"]) return;

            // Load the rpt file from the sharepoint library and display it in the viewer.
            // The report document is saved into the session variable in this method.
            DisplayReport();
        }

IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum