ReportViewer -- Adding a PageNavigation Event Handler Forces PostBack RRS feed

  • Question

  • I have set up multiple event handlers in Page_Init() for events such as PageNavigation, Back, and Drillthrough.  Something very peculiar that I am seeing is that setting up a PageNavigation event handler forces a PostBack regardless of whether or not a Page Navigation event actually takes place. 

    Shouldn’t the PageNavigation event handler behave like all the other event handlers?  For example, if I set up a single event handler for Back using BackEventHandler, a PostBack only occurs when I click on the back button (as expected).  With PageNavigation event handling in place, a PostBack occurs even when I do something completely different like Sort a column.  Why would the PageNavigation event fire even though I am not moving from page to page?  As far as I can tell, PageNavigation is the only event handler that behaves in this manner.

    Can someone confirm whether or not they are experiencing the same behavior when using PageNavigationEventHandler?

    Monday, January 11, 2010 7:48 PM

All replies

  • This behavior is by design.  The events that are causing a postback can result in page navigation.  Sorting, for example, reprocesses the report, which can result in the item you clicked on being on a different page after the sort.  The report viewer won't know if it does actually change the page number until it processes the sort.  So it needs to postback to ensure that the event handler can be called if it is needed.

    Note that this behavior is much less significant with VS 2010 where all postbacks are done via ASP.Net AJAX.
    Tuesday, January 12, 2010 5:33 AM
  • I can see the value in requiring a PostBack; however, doesn't this actually break the Text Search functionality?  I posted in another thread (ReportViewer -- Prevent Report from Refreshing when doing a Text Search in Local) about the Scroll Position not being retained after clicking "Find".  Because the PageNavigation event handler requires a PostBack by design, the scroll position is reset after the report is reloaded.  The user then has to manually scroll down to search for the highlighted text, which kind of defeats the purpose for Text Search functionality.
    Tuesday, January 12, 2010 3:06 PM
  • The report should still be scrolling to the correct position after searching for text.  If you are seeing this behavior, I would recommend filing an issue at with the ASPX page that is causing the problem so that we can investigate this further.
    Wednesday, January 13, 2010 3:03 AM
  • A bug has been filed at under BUG ID: 526023.  A Visual Studio project has been attached to this case for those of you curious about the behavior I have described.
    Thursday, January 21, 2010 2:19 PM