How can you add your own print and export buttons to the CR viewer toolbar?

I posted a previous question that was asking how to get around the Information Bar in IE7 when you export and print.  Unfortunately the CR viewer file download code gets blocked by IE7 because the buttons don't directly download the file.  However, I have been able to get a regular button that calls the following code and streams the file to the client and IE7 does not block it. 
Sub PrintPDF(sender As Object, e As System.EventArgs)
     Dim crReportDocument as ReportDocument
     Dim crExportOptions as ExportOptions
     Dim crDiskFileDestinationOptions as DiskFileDestinationOptions
     Dim Fname as string
     CrReportDocument = New ReportDocument()
     CrReportDocument.Load(Server.MapPath("estactionlist.rpt"))
     Fname = Server.MapPath("./") & Session.SessionID.ToString & ".pdf"
     CrDiskFileDestinationOptions = New DiskFileDestinationOptions()
     CrDiskFileDestinationOptions.DiskFileName = FName
     CrExportOptions = crReportDocument.ExportOptions
     With crExportOptions
          .DestinationOptions = CrDiskFileDestinationOptions
          .ExportDestinationType = ExportDestinationType.DiskFile
          .ExportFormatType = ExportFormatType.PortableDocFormat
     End With
     CrReportDocument.Export()
     Response.ClearContent()
     Response.ClearHeaders()
                Response.AddHeader("content-disposition", "attachment;filename=test.pdf")
                Response.ContentType = "application/pdf"
                Response.Charset = ""
                Response.WriteFile(Fname)
                Response.Flush()
     Response.Close()
     System.IO.File.Delete(Fname)
End Sub
So here are my questions?
1. Is it possible to add a custom print control/icon to the CR viewer toolbar?
2. If one is not possible, then is it possible to override the CR viewer print and export buttons with your own subroutines like the one above?
I just want my page to look nice and hate to have print and export buttons outside of my CR viewer. 
Thanks,
Kevin

It might be possible to replace the buttons in a windows app since you can retrieve the toolbar as a toolbar object in the winform viewer  ( ToolStrip toolBar = (ToolStrip) crystalReportViewer1.Controls[3]; )  however with a web app, it's a lot more difficult.
The problem is that that you need to parse the Request string to try and figure out if the print / export button was clicked.  The code below makes the print button disappear if you click it, so you should be able to modify it to call your custom printing / exporting code instead  (You have to do this check in a postback)
        Dim I As Integer = 0
        If Request.Form.AllKeys.Length > 0 Then
            For I = 0 To Request.Form.AllKeys.Length - 1
                Response.Write(Request.Form.Keys(I).ToString & "<BR>")
                If Request.Form.Keys(I).ToString = "CrystalReportViewer2:_ctl2:_ctl2.x" Then
                    CrystalReportViewer2.HasPrintButton = False
                End If
            Next
       End If
Shawn

Similar Messages

  • Can you save your own theme and button set up so I can use the same format

    Can you save your own theme and button set up, so I can use this same format for similar content. I want to keep the button content and the theme the same without having to create it everytime? I am trying to streamline the process for multiple dvd's with the same menu and buttons but different content. Does that make sense?

    I am only new to this caper too, but I am pretty sure you can save a theme as a favourite by pressing the "save theme as favourite" button under file. If you have edited an existing theme but don't want to lose it, make sure you untick the replace existing button.

  • Premiere CS4 - How can you import QuickTime (.mov) videos and which settings for the sequence?

    Premiere CS4
    How can you import QuickTime (.mov) videos and which settings for the sequence?
    Please reply in plain English or if possible in German
    Greetings from Vienna, Peter

    I have not installed Quicktime.
    I got a few scenes (.mov) from a Canon Eos 70d.
    I want to create a short film (in Premiere CS4) with these scenes, mixed with photos and MP3 music.

  • How can you change your security questions and answers if it doesn't show the link forgot answer?

    how do you change your security questions/answers if it does not show the link forgot answers

    Hi, Morganr2954.  
    Thank you for visiting Apple Support Communities.  
    I understand that you want to reset your security questions.  Here is an article I would go though for this.  
    If you forgot the answers to your Apple ID security questions
    http://support.apple.com/en-us/HT201485
    Cheers, 
    Jason H.  

  • How can you "Add document" in shared documents without allowing editing the page ie Contribute?

    Hello Community
        Using SharePoint 2010 Server and the UI, when you click "Site
    Actions" - "New Site" and you create Team Site that that is a
    Sub-site. 
        When you create the Visitor, Members and Owners groups
    how can you allow the user to add a document while at the same
    time not allow them to edit the page when adding the document
    as the only permissions are Full Control, Contribute and Read?
        Thank you
        Shabeaut

    Hi Shabeaut,
    To create a new permission level, you should manage the Parent (site collection).
    Your current location is subsite, and it looks like it has unique permission(broke inheritance) that is the reason you are not able to see the create permission level. and another reason for seeing Inherit Permissions along with other menus in the ribbon.
    You should also see Manage Parent along with the menus you see when your site inherits permission from parent.
    So, go to your site collection and create a new permission level and assign users to it.
    And to assign permission level to your new groups, you will be able assign permission when you create a new group, along with the name, all permissions would be listed in the same page(_layouts/newgrp.aspx).
    see the below screenshot for more info -
    ->Site Actions menu-> Site Settings->Users and Permissions->Site ->Permission Levels.
    Hope this helps!
    MCITP: SharePoint 2010 Administrator
    MCTS - MOSS 2007 Configuring, .NET 2.0
    | SharePoint Architect | Evangelist |
    http://www.sharepointdeveloper.in/
    http://ramakrishnaraja.blogspot.com/

  • How can you fix your iphone when it is stuck on the apple logo

    My Friend has an iPhone 3G(S) and  he wanted to put music on his iPhone. So he connected it to iTunes and said that the iPhone Had an iOS update. so he did the update and after the update, it got stop on the apple logo and it got an error and the iPhone is not responding and it is stuck on the Apple Logo.

    Alright Hernan there are a couple of steps you could try.
    Your first step has been mentioned twice, that is a "Hard reset". This can be done by holding both the Power/Lock Button (Top left hand corner of the device) and the Home Button (Circular button in the Bottom-Middle of the device) for about 3-5 seconds until the device shuts down, then attempt to start it up again.
    If this fails, you may have to take a rather drastic measure and put the device into "Forced Recovery Mode". This will erase all your data on your iPhone (So I'd hope you won't have to do this unless you backed up recently) and reset it to an empty device.
    To do this, head over to this article on the Apple Support Site and follow the instructions.
    http://support.apple.com/kb/HT1808.
    It does say for unable to restore or update, but look for the section where it says "Use the following steps to place your device into recovery mode."
    Hope this helps you!
    Regards,
    Kamikaze Kitten

  • Can you add your own designed frames, a psd file, to images in Aperture 3 and save this action to repeat?

    Hi, i'm an event photoger and trying to figure out the least expensive way to process numerous 5x7 images with a predesigned psd template/frame for print. All the images will have the same frame on it as well be the same size. Current process is too put each individual image into the psd template and print. Trying to find a way to automate/batch this action.

    Check out the Border FX plug-in for Aperture.  It's free.  If it can do what you want, then you can just select the border preset on export and go have an espresso. 

  • How can you make your OWN text slides on imovie

    What i mean by this is, is there any other way to make text slides in imovie other than the options they already give you? I want to make my own, i'm not a fan of the ones they give

    You can use Keynote and then use in imovie.
    The trick is to Share from Keynote as a QuickTime movie. Use Timed Advance, not Manual Advance.
    If you are using Green Screen, make a gradient background of two similar shades of green.
    Here is a "green screen" example.
    Here is a Picture in Picture example

  • How can you change your security questions!! i got a new iphone 5 and i forgot them!!

    How can you change your security questions?! I got the iphone 5 and i forgot them and it wont let me buy songs!!!!

    Click here and request assistance.
    (72909)

  • HT201320 How can you add an email address in your email box in an ipad

    How can you add your e-mail address in you iPad mail box?
    Rita

    Go to settings.app -> mail, contacts, calendars-> click "add account"
    Hope this helped

  • When I try to print sth I can´t choose my printer. Adobe Reader only shows a printer I used years ago.I aleady deleted and reinstalled the Reader and deleted all other printers from the computer.How can I add a new printer to Adobe Reader?Thanks for help!

    When I try to print sth I can´t choose my printer. Adobe Reader only shows a printer I used years ago.I aleady deleted and reinstalled the Reader and deleted all other printers from the computer.How can I add a new printer to Adobe Reader?Thanks for help!

    Hi,
    I would suggest you to uninstall Adobe Reader using the cleaner tool and then re-install the latest version.
    Adobe Cleaner Tool:- Download Adobe Reader and Acrobat Cleaner Tool - Adobe Labs.
    Latest version of Adobe Reader:- http://get.adobe.com/reader/
    If you still experience the same issue, please share the following information:-
    - Screenshot of Adobe Reader showing printer options
    - Screenshot of Microsoft Word showing printer options
    - Screenshot of control panel- Control Panel\All Control Panel Items\Devices and Printers
    Regards,
    Nakul 

  • How can you make your persona show on the top and bottom? Also can you make it bigger at the top to show more of the picture?

    How can you make your persona show on the top and bottom?
    Also can you make it bigger at the top to show more of the picture?

    Add extra empty toolbars if you want to see more of the persona.<br />
    You can create extra toolbars to get extra space via View > Toolbars > Customize<br />
    You have to put something on a toolbar (drag a Space item onto it) before closing the Customize window because empty toolbars are automatically removed.<br />
    See http://kb.mozillazine.org/Toolbar_customization

  • You must add your own card and email address in Contacts to be able to use mail alerts. mean

    I am trying to set up notifications in Calendars. I click "custom" and choose email. I get a message"You must add your own card and email address in Contacts to be able to use mail alerts." I have my own email address entered into Contacts, but don't know what this message intends, or how to deal with it. Please advise.
    Thanks

    Thank you Eric. So easy, when you know what you're doing.
    Thanks.

  • How can you keep your iPhone 4 (using it as my car's iPod) staying on the Audible app?  When I leave the car and return to continue hearing a book, it has switched to iTunes.

    How can you keep your iPhone 4 (using it as my car's iPod) staying on the Audible app?  When I leave the car and return to continue hearing a book, it has switched to iTunes.

    The first time an iPhone is connected to iTunes that is used to sync with another iPhone or iOS device, you are prompted to transfer the backup for the other iPhone or iOS device or to set up the iPhone as a new iPhone.
    The former does as provided - it transfers the backup for the other iPhone or iOS device to the iPhone replacing all data on the iPhone that is included with the backup being transferred. The latter does nothing allowing you to make your various selections for the iPhone sync preferences with iTunes.
    This is designed to be done right away with a new iPhone.
    If you don't have a backup for the iPhone with iTunes on your computer and don't have an iCloud backup that hasn't been updated since choosing to transfer the backup for your iPod Touch to the iPhone, the data that was on the iPhone is gone.

  • How can you get your ipod touch open when you forgot the password and its disabled and not connected to wifi

    How can you get your iPod touch open when you forgot the password and its disabled and not connected to the Internet Connection and you don't want to reset it.

    Disabled
    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Forgot passcode or device disabled
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:                                                             
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: Back up and restore your iOS device with iCloud or iTunes       
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:                         
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        
    If problem what happens or does not happen and when in the instructions? When you successfully get the iPod in recovery mode and connect to computer iTunes should say it found an iPod in recovery mode.

Maybe you are looking for

  • Mac mini support for Samsung Syncmaster 244T

    I recently purchased a Mac mini 2.3GHz quad-core Intel Core i7 and wanted to connect it to a Samnsung Syncmaster 244T monitor. I connected it using the Mini DisplayPort to DVI Adapter but it would not display. I also attempted to use the HDMI to DVI

  • Starting with JavaFX 2.0 - Any doubts

    I'm starting with JAvaFX 2.0. I need to make a application, but a have any doubts. - Whats the better, make layouts (Forms) in FXML or JAva Code ? Because, i read any developers prefers use Java Code, to make complex layouts (forms); - JavaFX has a D

  • "Include transparency" on export to QT?

    Okay, what does this mean, anyway? When exporting a Keynote show to QuickTime, one of the options is to "include transparency". What does that mean? What gets identified as "transparent"? --Dave Althoff, Jr.

  • Downloaded and updated Photoshop, yet no option to run in Creative Cloud.

    I just purchased a monthly subscription to Photoshop on Creative Cloud. I had previously downloaded and used a trial version, and I seem to be having trouble now accessing the Creative Cloud version. In the Creative Cloud application manager it lists

  • Need different rows from single query based on condition

    Hi, I have a table with 100 rows that holds employees and their roles. I need to write a SQL(not a PL/SQL block) as below 1. When employee with role 'VP' logs in, the query should return all the 100 rows. 2. When employee with role 'MGR' logs in, the