Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The clear solution is quite simple, if you know how to do it. ;)</p> <p>All what you have to do is adding following code:</p> <p> </p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; $(document).ready(function() { $('.A0').get(0).ClientController.CustomOnReportLoaded = function() { this.m_reportObject.m_navigationId = null; }; }); &lt;/script&gt; </code></pre> <p></p> <p>where "A0" from <code>$('.A0')</code> is css class name assigned to ReportViewer control.</p> <p>For reference I'm pasting method initializing ReportViewer control:</p> <pre><code> protected void InitializeReportViewer(string ID) { string reportsPath = ConfigGetter.GetReportsPath(); string reportingServerUrl = ConfigGetter.GetReportingServerUrl(); Instance = new ReportViewer(); Instance.ID = ID; Instance.CssClass += ID; Instance.ProcessingMode = ProcessingMode.Remote; Instance.ServerReport.ReportServerUrl = new Uri(reportingServerUrl); Instance.ServerReport.ReportPath = reportsPath + Config.Filename; Instance.Enabled = true; Instance.InternalBorderStyle = BorderStyle.None; Instance.EnableViewState = true; if (Config.AutomaticSize) { Instance.AsyncRendering = false; Instance.SizeToReportContent = true; } else { Instance.Width = Config.Width; Instance.Height = Config.Height; } Instance.ShowParameterPrompts = false; Instance.ShowToolBar = false; SetParameters(); } </code></pre> <p>which is invoked for above example like:</p> <pre><code> InitializeReportViewer("A0"); </code></pre> <p>Below explanation, why it works:</p> <p>ReportViewer control generates a lot of javascript code, which contains between others following:</p> <pre><code>function OnLoadReport(reloadDocMap) { this.m_clientController.OnReportLoaded(this, reloadDocMap); if (null != this.m_navigationId &amp;&amp; this.m_navigationId != "") window.location.replace("#" + this.m_navigationId); if (this.m_autoRefreshAction != null) setTimeout(this.m_autoRefreshAction, this.m_autoRefreshInterval); } RSReport.prototype.OnLoadReport = OnLoadReport; function OnReportLoaded(reportObject, reloadDocMap) { this.m_reportObject = reportObject; this.CurrentPage = reportObject.m_pageNumber; this.TotalPages = reportObject.m_totalPages; this.m_searchStartPage = reportObject.m_searchStartPage; // Update the client side page number so that it is available to the server object // if it was changed asynchronously. var clientCurrentPage = GetControl(this.m_clientCurrentPageID); if (clientCurrentPage != null) clientCurrentPage.value = this.CurrentPage; // If there is a document map, display it if (this.HasDocumentMap()) { // This method is called each time the report loads. This happens // for page navigations and report actions. For many of these cases, // the doc map didn't change, so don't reload it. if (reloadDocMap) { if (this.CanDisplayBuiltInDocMap() &amp;&amp; this.m_docMapUrl != "") { var docMapReportFrame = frames[this.m_docMapReportFrameID]; docMapReportFrame.frames["docmap"].location.replace(this.m_docMapUrl); } this.CustomOnReloadDocMap(); } if (this.m_docMapVisible &amp;&amp; this.CanDisplayBuiltInDocMap()) this.SetDocMapVisibility(true); } this.CustomOnReportLoaded(); } </code></pre> <p>Annoying scrolling is because of this part of code:</p> <pre><code> if (null != this.m_navigationId &amp;&amp; this.m_navigationId != "") window.location.replace("#" + this.m_navigationId); </code></pre> <p>So we need to set <code>this.m_navigationId</code> to null. Where?</p> <p>Before this part of code <code>this.m_clientController.OnReportLoaded</code> method is invoked, and on it's end is invokation of method <code>CustomOnReportLoaded()</code>, so we just need to set null for <code>m_navigationId</code> in this method. And we are doing it. Voila!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload