• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1289
  • Last Modified:

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

I have a .aspx file that includes a ReportViewer control (ver. 8.0.0.0).  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
   Try
      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"
 
      Response.Flush()
      Response.BinaryWrite(bytes)
      Response.End()
 
   Catch ex As Exception
       CaptureError(ex)
   End Try
End Sub

Open in new window

0
JackWooten
Asked:
JackWooten
  • 2
  • 2
1 Solution
 
matthewrhoadesCommented:
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.
0
 
JackWootenAuthor Commented:
The view report button is defined in the .rdl file created by the reporting service reports project.
0
 
matthewrhoadesCommented:
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.
0
 
JackWootenAuthor Commented:
The answer was to change the linkbutton to a regular button.  This seems to keep the focus and prevent calling the click event.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now