After click to print on toolpanel, response.redirect will not exit page!

On the aspx page where in either the init or page load I execute the code for the report, it will display, and the toolpanel appears, and I can click the printer icon and the report will print.
It merrily reexeuctes the init and page load for every page in the report, which is insane, but from what I see searching Google, that is just the way it works.
I can live with that, but here is the real problem.
I have three buttons at top of page, each an http redirect to leave the page and go to another. I mean, I have to give the user a way out, right?
They will work if clicked on first entering the page before printing the report.
However, once you have clicked the icon in the Crystal toolpanel to print the report, YOU CANNOT ESCAPE THE PAGE! It will not go away.
I even put in code to trap the id of the control clicked, skip the crystal report loading code, included close and dispose methods on Crystal report AND the crystalreportviewer object, even set the objects to null.
Does not matter.
Execution will jump to the button code and hit the response.redirect command. And just stay on the page. The page is still live, you can click the button again and again. Occasionally maybe one out of 30 clicks, it will exit the page.
Note also, because of how Crystal is executing the init and page_load on every page in the report, it executes the page_unload on every pass, too, I discovered that by adding a page_unload and trying to put dispose code there.
Here is the entire aspx page behind code. This is Visual Studio 2010, C#, CR for Visual Studio 13 installed.
    public partial class ReportInvoicePackingListPrint : mmBusinessWebPage
        private ReportDocument report = new ReportDocument();
        protected bool leavingpage;
        protected void Page_Load(object sender, EventArgs e)
            // Amazingly, clicking a control to LEAVE the page REEXECUTES THE PAGE LOAD!!
            // I do not understand why, but checking for the ID of the controls on the page allows you to return and skip the rest of the page load.
            Control ctrl = PageUtilities.GetPostBackControl(this.Page);
            // if (ctrl != null && (ctrl.ID == "btnMainMenu" || ctrl.ID == "btnNewSearchHeader"))
            if (ctrl != null &&
                        (ctrl.ID == "btnMainMenu"
                            || ctrl.ID == "btnLocateByCustomerInfo"
                            || ctrl.ID == "btnReportInvoicePackingList"
                // We are going to redirect away to another page, OR we are re-entering and want to force !PostBack and Page_Load code.
                // Skip Page_Load code and all the database calls and setup overhead.
                leavingpage = true;
                report.Close();
                report.Dispose();
                CrystalReportViewer1.Dispose();
                CrystalReportViewer1 = null;
                report = null;
                return;
            string rpt_path = System.Web.HttpContext.Current.Server.MapPath("~/App_Reports_Crystal/InvoicePackingList.rpt");
            report.Load(rpt_path, CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault);
            // Retrive BatchNumber passed to this page and set the parm for the report object.
            string batchnumber = SessionProxy.BatchNumber;
            report.SetParameterValue("BatchNumber", batchnumber);
            CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
            CrystalReportViewer1.ReportSource = report;
        protected void btnReportInvoicePackingList_Click(object sender, EventArgs e)
            Response.Redirect("~/App_Reports_Pages/ReportInvoicePackingList.aspx", true);
        protected void btnMainMenu_Click(object sender, EventArgs e)
            Response.Redirect("~/App_Menus/MainMenu.aspx", true);
        protected void btnLocateByCustomerInfo_Click(object sender, EventArgs e)
            Response.Redirect("~/App_Pages/CustLookUp.aspx", true);

Hi,
I was too encountering the same problem. I had tried Uher's solution. It doesn't work.
Plus in this QnA is there a resolution?? Below is my code.
//Report1.aspx
using CrystalDecisions.CrystalReports.Engine
namespace Report1
     //Current Code using Page_Init to pre-Renders the report
     protected void Page_Init(Object sender, EventArgs e)
         if (!IsPostBack)
           LoadReport();
         else
            CrystalReportViewer1.ReportSource = (ReportDocument)Session["sessionCryRpt"];
   //Previous Code & this is not working so disable
   protected void Page_Load(object sender, EventArgs e)
   //  if (!Page.IsPostBack)
   //  {  LoadReport();  }
   protected void MainButton_Click()
    Response.Redirect("MainPage.aspx");
   protected void CrystalReportViewer1_Init()
   private void LoadReport()
    ConnectionInfo connectionInfo = new ConnectionInfo();
    connectionInfo.ServerName = @"server";
    connectionInfo.DatabaseName = "tbl1";
    connectionInfo.UserID = "sa";
    connectionInfo.Password = "sa";
    connectionInfo.Type = ConnectionInfoType.SQL;
    connectionInfo.AllowCustomConnection = true;
    string strParam = Convert.ToString(Request.QueryString["Param"]);
    label1.Text = strParam;
    ReportDocument cryRpt = new ReportDocument();
    Report1 crystalReport1;
    crystalReport1 = new Report1();
    cryRpt.Load(Server.MapPath("CrystalReport1.rpt"));
    SetDBLogonForReport(connectionInfo, cryRpt);
    cryRpt.SetParameterValue("Param", strParam);
    CrystalReportViewer1.SelectionFormula = "{Param}";
    CrystalReportViewer1.ReportSource = crystalReport1;
    CrystalReportViewer1.ReportSource = cryRpt;
    //Create session & assign ReportDocument to session
     Session["sessionCryRpt"] = cryRpt;
    private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
    Tables tables = reportDocument.Database.Tables;
    foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
     TableLogOnInfo tableLogonInfo = table.LogOnInfo;
     tableLogonInfo.ConnectionInfo = connectionInfo;
     table.ApplyLogOnInfo(tableLogonInfo);
//Report1.aspx code behind
<%@Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Report1.aspx.cs"       Inherits="Project.Report" %>
<td class="style5">
    <asp:Button ID="MainButton" runat="server" onclick="MainButton_Click"
       Text="Back To MainPage" Width="174px" CausesValidation="False" />
          </td>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
       <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
                EnableDatabaseLogonPrompt="False" ReuseParameterValuesOnRefresh="True"
                AutoDataBind="True" Height="1269px" ToolPanelWidth="200px" Width="881px"
                oninit="CrystalReportViewer1_Init" GroupTreeImagesFolderUrl=""
                GroupTreeStyle-ShowLines="False" ReportSourceID="CrystalReportSource1"
                ToolbarImagesFolderUrl="" ToolPanelView="None"
                EnableParameterPrompt="False" SeparatePages="False" HasCrystalLogo="False"
                HasToggleGroupTreeButton="False" HasToggleParameterPanelButton="False" />
            <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
                <Report FileName="CrystalReport1.rpt">
                </Report>
            </CR:CrystalReportSource>
</asp:Content>

Similar Messages

  • After clicking Clear List in Firefox downloads, Firefox will not show any downloads in the list how do I fix this?

    Firefox version 5
    I had numerous items int the downloads window. I clicked clear list and it did. Now when I download something, it flashes for just a second in the downloads window and then disapears. The file is actually downloaded to the downloads folder.

    -> Update ALL your Firefox Plug-ins https://www.mozilla.com/en-US/plugincheck/
    -> go to View Menu -> Toolbars -> unselect All Unwanted toolbars
    -> go Tools Menu -> Clear Recent History -> ''Time range to clear: '''select EVERYTHING''''' -> click Details (small arrow) button -> place Checkmarks on '''Cookies & Cache''' -> click "Clear Now"
    -> go to Tools Menu -> Options -> General -> place Checkmark on "Show the Downloads window when downloading a file" -> select Radio Button option2 "Always ask me where to save files"
    -> go to Tools Menu -> Options -> Content -> place Checkmarks on:
    1) Block Pop-up windows 2) Load images automatically 3) Enable JavaScript
    -> go to Tools Menu -> Options -> Privacy -> History section -> ''Firefox will: '''select "Use custom settings for history"''''' -> REMOVE Checkmark from "Permanent Private Browsing mode" -> place CHECKMARKS on:
    1) Remember my Browsing History 2) Remember Download History 3) Remember Search History 4) Accept Cookies from sites -> select "Exceptions..." button -> Click "Remove All Sites" at the bottom of "Exception - Cookies" window
    4a) Accept Third-party Cookies -> under "Keep Until" select "They Expire"
    -> REMOVE CHECKMARK from CLEAR HISTORY WHEN FIREFOX CLOSES
    -> go to Tools Menu -> Options -> Security -> place Checkmarks on:
    1) Warn me when sites try to install add-ons 2) Block reported attack sites 3) Block reported web forgeries 4) Remember Passwords for sites
    -> Click OK on Options window
    -> click the Favicon (small drop down menu icon) on Firefox SearchBar (its position is on the Right side of the Address Bar) -> click "Manage Search Engines" -> select all Unwanted Search Engines and click Remove -> click OK
    -> go to Tools Menu -> Add-ons -> Extensions section -> REMOVE All Unwanted/Suspicious Extensions (Add-ons) -> Restart Firefox
    You can enable your Known & Trustworthy Add-ons later. Check and tell if its working.

  • I am trying to create my own apple id, but when i try to click creat my id, i am redirected to the same page, there are no errors saying anything is wrong

    i am trying to create my own apple id, but when i try to click creat my id, i am redirected to the same page, there are no errors saying anything is wrong

    Here is a link that should meet your needs.
    Rescue email address and how to reset Apple ID security questions
    Let us know how you got on.

  • TS3212 After Clicking on iTunes Download i just see the note that Thank you for downloading , However i do not see any files getting downloaded.

    After Clicking on iTunes Download i just see the note that Thank you for downloading , However i do not see any files getting downloaded....

    Hi there,
    I would recommend taking a look at the troubleshooting steps found in the article below.
    Trouble installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/HT1926
    -Griff W.

  • I have an iphone 4 and after updating it to the ios5 software, it will not allow me to activate nor allow me to leave the setup page. i cannot even restore it. does anyone know what to do?

    i have an iphone 4 and after updating it to the ios5 software, it will not allow me to activate nor allow me to leave the setup page. i plugged it into itunes and it is stuck there too... i cannot even restore it. does anyone know what to do?

    I have had this same issue but thankfully fixed it. Follow he steps below:
    Sync your iPhone with you iTunes therefore your info is backed up. Unplug your phone.
    Go to Settings > Reset > Erase All Content and Settings
    Once your phone has reset and come back on answer the question until it asks if you want to back up from itunes Click this then plug your phone in.
    After everything has sync'd back to your phone everything should work fine.
    Hope this helps.

  • I have a Officejet 8500 A910n. When printing a pdf the print job just stops and will not print.

    Only certain files the print job just stops and will not print in Adobe Acrobat X.  All other applications work fine.

    Have you tried downloading and installing Adobe Acrobat XI?  http://www.adobe.com/products/reader.html
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • I am trying to burn some cds from my playlist on itunes, but my playlist shows many of my songs in light print and says that it will not burn because it is not a file, these are all songs I have purchased quite a while ago, how do i get them to files?

    I am trying to burn some cds from my playlist on itunes, but my playlist shows many of my songs in light print and says that it will not burn because it is not a file, these are all songs I have purchased quite a while ago, how do i get them to files?

    If they were songs you purchased from itunes, try redownloading them from your purchases...
    if that doednt work, make sure the optuon to copy files to itunes media folder is checked in settings, then find and download from the net. and re-add them to your library

  • After removing system fonts and reinstalling fonts, FireFox will not start

    After removing system fonts and reinstalling fonts, FireFox will not start! When I start FireFox the "Mozilla Crash Reporter" opens as if FF just crashed??? I don't see any records in event viewer. I am using FF v3.6.3 on a Windows 7 box. I tried uninstalling 3.6.3 and installing 3.0.18 and had the same problem!
    == This happened ==
    Every time Firefox opened
    == After a uninstalled all fonts including system fonts and then reinstalling system fonts. ==
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.4; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; AskTB5.5)

    The files with submitted crash report ids are inside the ''submitted '' directory, from the directory you found the LastCrash.txt timestamp file.
    The file names will begin with '''bp-'''
    There might be more information from the crash report, but it might just tell us you are crashing the first time Firefox tries to use a font.
    One thing I suppose you could do is select only those fonts you've got in Tools -> Options -> Content -> Fonts and Colors -> Advanced and then uncheck the '''Allow pages to use their own fonts''' option.
    See http://support.mozilla.com/en-US/kb/Options+window+-+Content+panel#Fonts_Dialog
    To be honest, I can't find anything on this Netscape Font Navigator and it sounds highly dubious.

  • I have Photoshop Elements 9 on an iMac with OS 10.6.8. I bought a new printer/scanner and the program will not import the new scanner to replace the old one. How do I do this?

    I have Photoshop Elements 9 on an iMac with OS 10.6.8. I bought a new printer/scanner and the program will not import the new scanner to replace the old one. How do I do this?

    Thank you for your suggestions. I downloaded a more recent version of Twain, but this didn't help. I also tried closing and opening Photo Shop and restarting my computer without success. Reinstalling Photo Shop sounds like a very promising solution, but I'm  not sure I will do it. In the meantime I can scan items using a printer program. These scans open in Photo Shop. It is an extra step.

  • Airplay is not working after the latest update, whats wrong? Sound will not go to Apple TV or my Surround receiver

    Airplay is not working after the latest update, whats wrong? Sound will not go to Apple TV or my Surround receiver

    Hi Tokha,
    If you are having an issue with using AirPlay from your MacBook Air, I would suggest that you troubleshoot using the steps in this article - 
    iTunes: Troubleshooting AirPlay and AirPlay Mirroring - Apple Support
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • After resetting my phone to factory settings, it will not turn on. When i press the power button a white screen and black apple pop up. it stays on that screen and will not go to the home screen, it will just die. please help!

    after resetting my phone to factory settings, it will not turn on. When i press the power button a white screen and black apple pop up. it stays on that screen and will not go to the home screen, it will just die. please help!

    Make sure it is charged for about 10min using the adapter, then connect in recovery mode, explained in this article:
    If you can't update or restore your iOS device

  • After loading the latest Aperture 3 update, aperture will not load and it appears to have corrupted 10.6.  10.6.7 now appears to be missing from the computer and my administrator status has changed to standard.

    After loading the latest Aperture 3 update, aperture will not load and it appears to have corrupted 10.6.7. and now appears to be missing from the computer and my administrator status has changed to standard.  Update Software says I need to do update to 10.6.7 which I can't do because administrator privileges are gone.   I didn't back-up with Time Machine ,BAD, but I have all files backed-up on another hard drive.  Should I just reformat and start over?  Any ideas or help would be appreciated.

    PROBLEM SOLVED! For me at least!
    Apple Support gave me the clue - I had run Migration Assistant, and it had obligingly replaced a system file (/Library/Frameworks/PluginManager.framework/Versions/B/PluginManager) with the equivalent from my old system.
    I reinstalled 10.6.7 using the DVD supplied and all is well.
    The moral is - don't use Migration Assistant.
    Along the way Apple Support provided me with a link to download Combo update 10.6.7: this could not be installed on my iMac.
    Hope this helps.

  • Can anyone help me, I am trying to create courses using Captivate for Udemy, but even after saving the courses as pdf files, Udemy will not reconize them. NOw I am back to square one because according to Udemy techs, they do not support Captivate files.

    Trying to create my courses using Adobe Captivate, but even after saving the files as a pdf it will not upload in Udemy. What can I do?

    Yep, you lose all interactivity when publishing to video.
    Udemy, Lynda.com, Total Training and other similar models are based on simple "watch the video to learn" type of consumption. The only real interactivity you get is an ability to pause, rewind, fast forward. Basically anything you can do with a video.
    Cheers... Rick

  • After upgrading to latest version of iTunes it will not remember my podcast password as it did before

    After upgrading to latest version of iTunes it will not remember my podcast password as it did before

    Hey becky612,
    Thanks for the question. I understand that your iPod nano is not recognized in iTunes after updating. The following troubleshooting articles may provide a resolution based on your symptoms:
    Windows
    iPod appears in Windows but not in iTunes
    iPod not recognized in 'My Computer' and in iTunes for Windows
    iTunes reports that "iTunes cannot recognize this iPod at this time"
    Thanks,
    Matt M.

  • TS1398 After leaving a wi-fi connection my iphone will not automatically connect to the internet via the 3G network unless I turn it off and then on again. Is there a setting that can be changed to overcome this issue?

    After leaving a wi-fi connection my iphone will not automatically connect to the internet using a mobile 3G network unless I turn my phone off and then back on again. Is there a setting that can be changed to overcome this?

    Then I'm at a loss. Mine has switched automatically from the start, favoring Wi-Fi, any of its registered networks, whenever available. Only thing I can think of is trying a Force Restart and see if that clears things up: hold down Home and Sleep till the screen goes black and a white Apple logo pops up. Release and allow it to restart.
    May be similar, when I got the i5 about 16 months ago, the local carrier was starting to roll out 4G service. The phone would regularly lose all carrier connection, voice and data. Haphazardly would reconnect when it felt like it afterwards. Initially did the Off/On dance to speed things up, but discovered that using Airplane Mode would do the same without the lengthier power cycle. After awhile, the carrier 'fessed they were having capacity issues and later the problem went away. So yours too may also be a carrier issue.

Maybe you are looking for

  • Adobe Reader 10 + Plugins = Adobe Reader has encountered a problem and needs to close.

    Platform:  Win XP SP3 and Win7 SP1 (both 32bit) Problem experienced with both Reader 10.0.1 and 10.1 To eliminate our custom plugins as an issue, we've performed our testing using a generic plug-in using the Adobe plug-in creation method. We encounte

  • How do I keep app progress when syncing to a new PC?

    I have an iPad 4 32GB WiFi. I recently upgraded my PC and reinstalled Windows / iTunes. I've gone through a 'sync to new PC' process before, with mixed results. I have a lot of games on my iPad and I lost the progress on several of them when I synced

  • Can you set a half-size (640x360) sequence in FCE?

    I have some older SWF ad units in my portfolio that cannot be converted to .mov files in Flash, so I'm forced to make video screen grabs of the sequences. They look nice and sharp at their original pixel dimensions of 336x280 pixels, but when grabbed

  • Associating oc4j instance with OID

    Hi All, I am trying to associate oc4j instance with OID in enterprise manager (as a first step towards configuring workflow identity service with OID). But I am getting the following error whenever I tried An error occurred while attempting to associ

  • We are sorry we are unable to continue with your activation at time

    When I trying to activate my i phone by i tunes appear to me this message ( we are sorry we are unable to continue with your activation at time ) , What can I do to activate it ??