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

时间:2014-10-06 20:15:45

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

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

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

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

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

Wayne E. Pfeffer

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

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

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

我最近在IE上遇到了这个问题,并将问题追溯到报告控件注册的javascript函数。 javascript函数添加了一个原型方法&#34; Show&#34;到&#34; DropDownParamClass&#34;。函数内部是一行代码,用于检查&#34; FORM&#34;是否存在。标签,如果它没有放弃功能...

// 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返回了一个&#34; DIV&#34; ...作为一个修复,我只是略微修改了DropDownParamClass.prototype.Show函数(不是新的解释变量&#34; readyToShowCalendar&#34;它检查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>

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