"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

JackWootenAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.