繁体   English   中英

为什么SSRS 2012日期选择器在Internet Explorer中不显示日历,而在Chrome中根本不显示日历?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM