[英]Why is SSRS 2012 date picker not showing the calendar in Internet Explorer and not showing at all in Chrome?
我有一些在頁面上具有SSRS報告控件的ASP.NET代碼。 Web應用程序托管在與SSRS托管不同的服務器上。 我遇到的問題是,當我在Internet Explorer中上拉報告時,日期選擇器控件未顯示日歷,如果我嘗試在Chrome中上拉報告,則日期選擇器控件根本不會顯示。 如果我在文本框中輸入日期,則報表可以正常工作,但是,我們真的很希望能夠使用日期選擇器控件。
關於可能出什么問題的任何想法?
我認為這個問題與之前提出的問題有所不同,因為我不僅在詢問非IE瀏覽器,而且還在詢問IE的問題。
當用戶單擊控件時,日期選擇器控件不會在IE中顯示日歷。
韋恩·普費弗
------編輯以添加代碼示例------
aspx代碼為:
<rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote" Width="100%" Height="100%" AsyncRendering="False">
</rsweb:ReportViewer>
<asp:ScriptManager ID="ScriptManager1" runat="server">
有一個下拉列表供您選擇報告,這是將報告加載到報告查看器中的代碼:
protected void loadViewer(string report) {
ReportViewer1.ProcessingMode = ProcessingMode.Remote;
IReportServerCredentials irsc = new CustomReportCredentials(
ConfigurationManager.AppSettings["ReportUser"],
ConfigurationManager.AppSettings["ReportPswd"],
ConfigurationManager.AppSettings["ReportDomain"]);
ReportViewer1.ServerReport.ReportServerCredentials = irsc;
ReportViewer1.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportURL"]);
ReportViewer1.ServerReport.ReportPath = ConfigurationManager.AppSettings["ReportPath"] + report;
ReportViewer1.SizeToReportContent = true;
//Get the list of account IDs that the user has viewothertransactions at
List<string> vaIds = new List<string>();
string votAccts = (String)Session["votAccounts"];
string[] aIds = votAccts.Split(',');
foreach (var aId in aIds)
{
vaIds.Add(aId);
}
//Create the list of account ids where the user can only see its orders
List<DropdownOption> acclist = (List<DropdownOption>)Session["searchAccounts"];
string acctIds = "";
if (null != acclist)
{
for (int i = 0; i < acclist.Count; i++)
{
if (!vaIds.Contains(acclist[i].Id))
{
acctIds += acclist[i].Id + ",";
}
}
if (acctIds.Length > 0)
{
acctIds = acctIds.Substring(0, acctIds.Length - 1);
}
}
Users user = (Users) Session["userObject"];
ReportParameter userid = new ReportParameter("Userid", user.Id.ToString());
ReportParameter votAccounts = new ReportParameter("VotAccounts", votAccts);
ReportParameter accounts = new ReportParameter("Accounts", acctIds);
log.Debug("Requesting report '" + report + "'. Parameters - Userid=" + user.Id + " VotAccounts=" + votAccts + " Accounts=" + acctIds);
ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { userid, votAccounts, accounts });
ReportViewer1.ServerReport.Refresh();
}
使用Internet Explorer 11時,您可以嘗試兼容模式。 嘗試在頁面上同時按F12鍵,以查看使用了哪種瀏覽器仿真。
我最近在IE上遇到了此問題,並將該問題歸結為報告控件注冊的javascript函數。 javascript函數將原型方法“ Show”添加到“ DropDownParamClass”。 函數內部有一行代碼,用於檢查是否存在“ FORM”標記,如果不存在,則放棄該函數...
// do not show the drop down if the frame has not yet been aded to the form tag
if (floatingIFrame.parentNode.tagName.toUpperCase() != "FORM")
return;
在我的情況下,floatingIFrame.parentNode.tagName返回“ DIV” ...作為修復,我只是使用經過稍微修改的版本覆蓋了DropDownParamClass.prototype.Show函數(而不是用於檢查以下內容的新的解釋變量“ readyToShowCalendar” DIV或FROM標簽),請參見下文...
<script language="javascript" type="text/javascript">
if (typeof (window.DropDownParamClass) !== "undefined") {
//Fix for bug in report viewer control resulting in the Calendar Control not displaying when the calendar icon is clicked.
window.DropDownParamClass.prototype.Show = function () {
var floatingIFrame = document.getElementById(this.m_floatingIframeID);
// do not show the drop down if the frame has not yet been added to the form tag
var readyToShowCalendar = "FORM,DIV".indexOf(floatingIFrame.parentNode.tagName.toUpperCase()) > -1;
if (!readyToShowCalendar) return;
// position the drop down. This must be done before calling show base. Otherwise,
// a scroll bar is likely to appear as a result of showBase which would make the
// position invalid.
var newDropDownPosition = this.GetDropDownPosition();
floatingIFrame.style.left = newDropDownPosition.Left + "px";
floatingIFrame.style.top = newDropDownPosition.Top + "px";
this.ShowBase();
// poll for changes in screen position
this.StartPolling();
};
}
</script>
然后將該腳本簡單地放在頁面上初始標簽的下面。 此后,單擊日歷圖標時,日歷控件似乎按預期方式打開。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.