Visual Studio Developer Center > Visual Studio Forums > Visual Studio Report Controls > ReportViewer HyperLinkTarget property problem
Ask a questionAsk a question
 

AnswerReportViewer HyperLinkTarget property problem

  • Tuesday, April 04, 2006 9:16 PMchuck02323 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am running a locally processed report in Asp.net  The report has a textbox with a hyperlink property.  In the report viewer control I have set the HyperLink target to "_Blank".

    When I look at the resultant page everything works fine for the first page.  If the user clicks on the hyperlink another browser window opens.  Unfortunately, if the user selects the next page in the report, the Hyperlink target functionality doesn't work.  Clicking on the link results in the clicked link displaying within the report viewer frame.

    Looking at the page source
        for page one the A tag is correct.
         for page two the A tag is missing the target=_blank


    Any suggestions?

Answers

  • Wednesday, April 05, 2006 2:27 AMBrian Hartman - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    This is a known issue with the controls.  The problem is related to asynchronous rendering.  To work around the issue, you essentially need to cause the viewer to perform page navigation via a postback instead of by iframe manipulation.  This can be done by setting AsyncRendering = false or by hooking up to the PageNavigation event (you don't need to do anything in the event, just listening on it will cause a postback needed to fire the event).

    The extra postbacks will result in some performance degradation and may affect the user experience depending on other controls on your page.  If this issue is causing significant problems for you, I recommend contacting Microsoft support for other options: http://www.microsoft.com/services/microsoftservices/srv_support.mspx

All Replies

  • Wednesday, April 05, 2006 2:27 AMBrian Hartman - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    This is a known issue with the controls.  The problem is related to asynchronous rendering.  To work around the issue, you essentially need to cause the viewer to perform page navigation via a postback instead of by iframe manipulation.  This can be done by setting AsyncRendering = false or by hooking up to the PageNavigation event (you don't need to do anything in the event, just listening on it will cause a postback needed to fire the event).

    The extra postbacks will result in some performance degradation and may affect the user experience depending on other controls on your page.  If this issue is causing significant problems for you, I recommend contacting Microsoft support for other options: http://www.microsoft.com/services/microsoftservices/srv_support.mspx

  • Sunday, August 06, 2006 12:35 PMkmin Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Brian,

    I am also having this error from reportviewer when I use hyperlink in my report.  You are right about the error going away if AsyncRendering=false.  However, it creates more problems for me.  When the report is launched, the report is not seen until I scroll to the right of the reportviewer.  Everytime I expand/collapse the rows in the report the focus go the far left of the viewer where I can't see the report, then I have to scroll to the rigth again.  Moreover, the cell size keep changing from the set width to a bigger one and my backgroud image is off since it is set to norepeat.

    I spend some time looing at your suggestion about PageNavigation event, however I can't get the hperlink to post back.  When i collapse/expand the row, there is a post back to the server in the page_load function and the report in refreshed to the original view, thus can't expand the rows.

    I had this problem with remote and local report and I think its from Reportviewer.  I beginning to think there is no solution to this bug and give up.

    Please help if you could get it to work. 

    I am using local mode report embed into my application since the data is coming from a class object.  I use a matrix to show the data. I have groups which uses hide functionality to expand/collapse the rows.

    Thanks you very much

    Mini

  • Friday, August 11, 2006 1:29 AMBrian Hartman - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The reason the report is reloading back to its original state is most likely because you are setting the report path or report server url after view state is loaded on the postback.  In this case, the viewer treats this as a new report definition and ignores any postback data from the client.  If your report path and server url are static for the page, they should be in Page_Init, which will prevent this problem.
  • Tuesday, August 22, 2006 8:28 PMchuck02323 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    This is for a local report and the report path is set as a property during design time.  Also at design time we set the report as embedded.

    Maybe this is part of the bug that doesn't let you use embedded local reports when you precompile the application.  However, it does happen during debug.



  • Wednesday, August 23, 2006 8:49 AMYole Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     I was wondering if there was any new solutions to this problem?

    I have tried setting AsyncRedering = false and adding an PageNavigationEventHandler, both of which disable the interactive sort on the reports, which, coincedently is the source of my problems.

    Once you click on the interactive sort, the Target="_top" no longer exists in the hyperlink properties.

    Any further suggestions will be appreciated.

    Thanks

    Yole.

  • Thursday, February 22, 2007 10:19 PMJaime_Martinez Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi, I was having the same problem but I solve it adding the OnPageNavigation="void_name" event in the control declaration in the aspx page. After that, in the aspx.cs page create the void as follow:

    public void void_name(object sender, PageNavigationEventArgs e)

    {

    this.ReportViewer1.HyperlinkTarget = "_top";

    }

    after doing this it Works !!!

     

  • Friday, March 02, 2007 11:49 PMBrian Hartman - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    This will work for some cases, but not always.  For example, if the report page changes without a page navigation (for example if the user clicks a toggle), then you will run into original problem.

    Note that this bug is fixed in Visual Studio 2005 SP1.

  • Tuesday, May 15, 2007 8:31 PMebailey Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi - we encountered this exact issue. The workaround listed immediately above (OnPageNavigation) appears to work well; we are continuing to test.

     

    I am unsure of what you mean by "this bug is fixed in Visual Studio 2005 SP1". Is this a Visual Studio issue or a SQL Server Reporting Services issue? Our builds are done directly against the SDK, not using Visual Studio - is this something that the service pack would help with?

     

    Thanks for your help! --Erik Bailey

  • Wednesday, May 16, 2007 1:35 AMBrian Hartman - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The problem is with the report viewer controls, which ship with Visual Studio.  You would see the same problem if you were using local mode, which doesn't use a report server.  The service pack contains an updated report viewer control which fixes this problem.