あなたがそれを行う方法を知っていれば、透明な溶液は、非常に簡単です。 ;あなたがしなければならないものをすべてのコード、次の追加された)
:$('.A0')
から "A0" はReportViewerコントロールに割り当てられたCSSクラス名です
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$('.A0').get(0).ClientController.CustomOnReportLoaded = function() {
this.m_reportObject.m_navigationId = null;
};
});
</script>
。参考のため
私はReportViewerコントロールを初期化する方法を貼り付けています:
のように、上記の例のために呼び出され
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();
}
:それが動作する理由、
説明以下
InitializeReportViewer("A0");
:
ReportViewerコントロールを多くのjavascriptコードを生成します。これには次のものが含まれます。
function OnLoadReport(reloadDocMap)
{
this.m_clientController.OnReportLoaded(this, reloadDocMap);
if (null != this.m_navigationId && 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() && this.m_docMapUrl != "")
{
var docMapReportFrame = frames[this.m_docMapReportFrameID];
docMapReportFrame.frames["docmap"].location.replace(this.m_docMapUrl);
}
this.CustomOnReloadDocMap();
}
if (this.m_docMapVisible && this.CanDisplayBuiltInDocMap())
this.SetDocMapVisibility(true);
}
this.CustomOnReportLoaded();
}
迷惑なスクロールがあるため、コードのこの部分は次のとおりです。
if (null != this.m_navigationId && this.m_navigationId != "")
window.location.replace("#" + this.m_navigationId);
だから我々はnullにthis.m_navigationId
を設定する必要があります。 どこ?
コード部分this.m_clientController.OnReportLoaded
が呼び出される前に、メソッドCustomOnReportLoaded()
の呼び出しが終了したので、このメソッドではm_navigationId
にnullを設定する必要があります。 そして、我々はそれをやっている。 Voila!
清掃をし、それIE11とChromeで動作します。私にとって完璧!答えとしてマークする必要があります。 –