"View Report" button on rdl file calling _click event of another control on .aspx file

Posted on 2008-11-13
Last Modified: 2012-05-05
I have a .aspx file that includes a ReportViewer control (ver.  The .aspx also includes a linkbutton (lbPrint) that generates .pdf version of the report and allows the user to download it.

Once this linkbutton is used (successfully) then using the "View Report" button on the actual report causes the linkbuttons click event to be called and the sender is shown as the linkbutton.

Has anyone seen this behavior?  Is there a way to prevent this?
Protected Sub lbPrint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbPrint.Click


      Dim streamids As String() = Nothing

      Dim mimeType As String = Nothing

      Dim encoding As String = Nothing

      Dim extension As String = Nothing

      Dim bytes As Byte()

      Dim sFileName As String = ""

      Dim cred As New ReportServerCredentials("rs", "XXX", "xxx.xx.1234")

      ReportViewer2.ServerReport.ReportServerCredentials = cred

      ReportViewer2.ShowCredentialPrompts = False


      ReportViewer2.ServerReport.ReportServerUrl = New Uri(resnet.Globals.Config.ReportServerPath)

      sFileName = "Exportable_Unit_Training_Summary.pdf"

      ReportViewer2.ServerReport.ReportPath = resnet.Globals.Config.ReportSubPath & "/TrainingSummaryFlatForUnit"

      params(0) = New Microsoft.Reporting.WebForms.ReportParameter("MemberID", CStr(CurrentMember.MemberID))

      bytes = ReportViewer2.ServerReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, Nothing)

      Response.AddHeader("content-disposition", "attachment;filename=" & sFileName)

      Response.ContentType = "application/pdf"




   Catch ex As Exception


   End Try

End Sub

Open in new window

Question by:JackWooten
    LVL 6

    Expert Comment

    I have never seen that before.  Does your label overlap your View Report button in any way?  Also, post the code for your View Report button.

    Author Comment

    The view report button is defined in the .rdl file created by the reporting service reports project.
    LVL 6

    Accepted Solution

    Try setting focus on another control at the end of your lblprint_click event to see if it is a focus issue.  Anything else on the form.

    Author Comment

    The answer was to change the linkbutton to a regular button.  This seems to keep the focus and prevent calling the click event.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now