Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-11-13
4
Medium Priority
?
1,200 Views
Last Modified: 2012-05-05
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
Comment
Question by:JackWooten
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:matthewrhoades
ID: 22954410
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
 

Author Comment

by:JackWooten
ID: 22954809
The view report button is defined in the .rdl file created by the reporting service reports project.
0
 
LVL 6

Accepted Solution

by:
matthewrhoades earned 1500 total points
ID: 22962405
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
 

Author Comment

by:JackWooten
ID: 23015311
The answer was to change the linkbutton to a regular button.  This seems to keep the focus and prevent calling the click event.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Integration Management Part 2
Loops Section Overview
Suggested Courses

810 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