【问题标题】:Why is SSRS 2012 date picker not showing the calendar in Internet Explorer and not showing at all in Chrome?为什么 SSRS 2012 日期选择器没有在 Internet Explorer 中显示日历,在 Chrome 中根本没有显示?
【发布时间】:2014-12-01 04:21:35
【问题描述】:

我有一些在页面上有 SSRS 报告控件的 ASP.NET 代码。 Web 应用程序托管在与托管 SSRS 的服务器不同的服务器上。我遇到的问题是,当我在 Internet Explorer 中拉出报告时,日期选择器控件未显示日历,如果我尝试在 Chrome 中拉出报告,则日期选择器控件根本不显示。如果我在文本框中输入日期,报告就可以正常工作,但是,我们真的希望能够使用日期选择器控件。

关于什么可能是错误的任何想法?

我认为这个问题与之前提出的问题不同,因为我不仅在问非 IE 浏览器,还问了 IE 的问题。

当用户点击该控件时,日期选择器控件不会在 IE 中显示日历。

韦恩·E·普费弗

----- 编辑添加代码示例 ------

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();
    }

【问题讨论】:

    标签: asp.net sql-server internet-explorer google-chrome reporting-services


    【解决方案1】:

    我最近在 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>
    

    然后,这个脚本被简单地放置在页面上初始标记的下方。此后,单击日历图标时,日历控件似乎按预期打开。

    【讨论】:

      【解决方案2】:

      使用 Internet Explorer 11 时,您可以尝试兼容模式。 尝试在页面上按 F12 以查看所使用的浏览器模拟。

      【讨论】:

        猜你喜欢
        • 2020-11-25
        • 1970-01-01
        • 2019-04-13
        • 2017-11-24
        • 1970-01-01
        • 1970-01-01
        • 2011-10-09
        • 2015-08-02
        • 2023-03-03
        相关资源
        最近更新 更多