VS2012 Crystal Report Viewer组树隐藏

时间:2013-10-06 22:22:58

标签: asp.net visual-studio-2012 crystal-reports

Asp.Net。带有CrystalDecisions.Web的Webform,版本= 13.0.2000.0 CrystalReportsViewer。

我想隐藏/禁用包含组树按钮的L.H.窗格。

DisplayGroupTree属性标记为已过时且无效。

我设置的ToolPanelView =“无”也无效。

组树问题的隐藏已经存在于早期版本中,但已发布的答案不起作用或转换为此版本,据我所见。

也许我正在构建错误的报告。 (显示OK)。

 private void ShowReport(MyClassLibrary.Report report)
    {
        ConnectionInfo cn = new ConnectionInfo();
        cn.ServerName = "MyServer";
        cn.DatabaseName = "MyDatabase";
        cn.UserID = "myUser";
        cn.Password = "myPassword";
        string reportDirectory = Server.MapPath(".") + "\\Reports\\";
        CrystalReportSource rs = new CrystalReportSource();
        Session["CurrentReportSource"] = rs;
        CrystalDecisions.Web.Report r = new CrystalDecisions.Web.Report();


        r.FileName = reportDirectory + report.reportPath;
        rs.Report = r;

        CRV.ReportSource = rs;



        ParameterFields p = CRV.ParameterFieldInfo;
        ParameterField pUserId = new ParameterField();
        pUserId.Name = "@user_id";
        ParameterField pStartDate = new ParameterField();
        pStartDate.Name = "@start_date";
        ParameterField pEndDate = new ParameterField();
        pEndDate.Name = "@end_date";

        ParameterDiscreteValue pUserIdValue = new ParameterDiscreteValue();
        ParameterDiscreteValue pStartDateValue = new ParameterDiscreteValue();
        ParameterDiscreteValue pEndDateValue = new ParameterDiscreteValue();

        TimeSpan t = new TimeSpan(30, 0, 0, 0);
        DateTime startDate = DateTime.Today - t;
        DateTime endDate = DateTime.Now;
        //**LIVE CODE***
        //CouponUser user = (CouponUser) Session["CurrentUser"];
        //pUserId_Value.Value = user.userId;
        //***TEST CODE***
        pUserIdValue.Value = 2;
        //********
        pStartDateValue.Value = startDate;
        pEndDateValue.Value = endDate;


        pUserId.CurrentValues.Add(pUserIdValue);
        pStartDate.CurrentValues.Add(pStartDateValue);
        pEndDate.CurrentValues.Add(pEndDateValue);

        p.Add(pUserId);
        p.Add(pStartDate);
        p.Add(pEndDate);


        foreach (TableLogOnInfo logOnInfo in CRV.LogOnInfo)
        {
            logOnInfo.ConnectionInfo = cn;
        }


        rs.DataBind();
    }

7 个答案:

答案 0 :(得分:11)

试 关闭:

CrystalReportViewer.ToolPanelView = ToolPanelViewType.None

开启:

CrystalReportViewer.ToolPanelView = ToolPanelViewType.GroupTree

组按钮将同时出现在

答案 1 :(得分:3)

鲍勃,

您是否尝试过HasToggleGroupTreeButton =“False”属性?我相信这将摆脱按钮和面板。

尝试一下,让我知道它是否有效。

克里斯

答案 2 :(得分:3)

controlname.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None
controlname.ShowGroupTreeButton = False
controlname.ShowParameterPanelButton = False

答案 3 :(得分:0)

您可以通过以下声明隐藏它:

crystalReportsViewer.ToggleSidePanel = SAPBusinessObjects.WPF.Viewer.Constants.SidePanelKind.None;

答案 4 :(得分:0)

我能够关闭组树并在我的查看器.xaml文件中隐藏其按钮。我在Visual Studio 2015中使用CR并在我的Grid标签中包含此行

 <cr:CrystalReportsViewer Name="ReportViewer"  ToggleSidePanel="None" ShowToggleSidePanelButton="False" ShowStatusbar="False" ShowLogo="False"  Grid.ColumnSpan="2" />

ToggleSidePanel = None将显示的项目设置为none ShowToggleSidePanelButton = False隐藏按钮,以便根本无法查看树。

答案 5 :(得分:0)

<Viewer:CrystalReportsViewer x:Name="BillViewer" ToggleSidePanel="None" />

答案 6 :(得分:0)

使用HasToggleGroupTreeButton =“ False”和ToolPanelView =“ None”隐藏TreeView

            <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"
            Height="50px"
            Visible="False" Width="350px" EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False" DisplayToolbar="False" SeparatePages="False" EnableDrillDown="False"
            HasDrilldownTabs = "False"
            HasToggleGroupTreeButton="false"
ToolPanelView="None"/>