在页面加载中Reportviewer visible = false

本文关键字:visible false Reportviewer 加载 | 更新日期: 2023-09-27 18:14:15

我的报表查看器有问题。如果我将我的报告查看器设置为visible=false在page_load页面上的事件按钮单击,如果我已经设置为visible=true,它仍然使报告查看器visible= false。有人能帮我解决这个问题吗?或者有任何其他解决方案…我在aspx页面中有2个reportviewer,我需要其中一个在page_load中为visible=false。这是代码…谢谢你

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindDdlCountryValue();
            ReportViewer_TotalCountry.Visible = false;

        }
protected void btnViewReport_Click2(object sender, EventArgs e)
    {
            ReportViewer_TTFSSummaryBasedOnCountry.LocalReport.Refresh();
            ReportViewer_TTFSSummaryBasedOnCountry.Visible = true;
            ReportViewer_TotalCountry.Visible = false;
    }
    protected void btn_AllCountry_Click(object sender, EventArgs e)
    {
            ReportViewer_TotalCountry.LocalReport.Refresh();
            ReportViewer_TTFSSummaryBasedOnCountry.Visible = false;
            ReportViewer_TotalCountry.Visible = true;
    }

如你所见,当我点击btn_AllCountry_ClickReportViewer_TotalCountry.Visible = true;=false:(

)

帮我. .我是第一次做这个报道。(


 <div>
    <rsweb:ReportViewer ID="ReportViewer_TTFSSummaryBasedOnCountry" runat="server" Font-Names="Verdana" Font-Size="8pt"
     InteractiveDeviceInfos="(Collection)" SizeToReportContent="True" WaitMessageFont-Names="Verdana" 6WaitMessageFont-Size="14pt" >
        <LocalReport ReportPath="RDLC'TTFSSummaryBasedOnCountry_Report.rdlc">
            <DataSources>
                <rsweb:ReportDataSource DataSourceId="ObjectDataSource_TTFSSummaryBasedOnCountry" 
                    Name="TTFSSummaryBasedOnCountry_DataSet" />
            </DataSources>
        </LocalReport>
    </rsweb:ReportViewer>
    <asp:ObjectDataSource ID="ObjectDataSource_TTFSSummaryBasedOnCountry" 
        runat="server" OldValuesParameterFormatString="original_{0}" 
        SelectMethod="GetData" 
        TypeName="IMP_report.ttfsListTableAdapters.TTFSSummaryBasedOnCountryTableAdapter">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList_Country" Name="CountryName" 
                PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
</div>
<div id="TotalCountry" align="center" >
<rsweb:ReportViewer ID="ReportViewer_TotalCountry" runat="server" Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(Collection)" 
  WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" SizeToReportContent="True" >
    <LocalReport ReportPath="RDLC'TTFSSummaryBasedOnCountry_Report.rdlc">
        <DataSources>
            <rsweb:ReportDataSource DataSourceId="ObjectDataSource_ttfsSummaryTotalCountry" 
                Name="TTFSSummaryBasedOnCountry_DataSet" />
        </DataSources>
    </LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource_ttfsSummaryTotalCountry" 
    runat="server" OldValuesParameterFormatString="original_{0}" 
    SelectMethod="GetData" 
    TypeName="IMP_report.ttfsListTableAdapters.TTFSSummaryBasedOnCountryTotalTableAdapter">
</asp:ObjectDataSource>
</div>

在页面加载中Reportviewer visible = false

在一些报告中我使用:

rptViewer.ShowReportBody = false; on Page_Load

rptViewer.ShowReportBody = true; on button_click .

我认为它解决了你的问题。

我有一个解决这类问题的方法,希望你喜欢,而不是设置ReportViewerVisibility。尝试将Div控件的Visibility设置为

<div id="TotalSummary" runat="server" >
    <rsweb:ReportViewer ID="ReportViewer_TTFSSummaryBasedOnCountry" runat="server">
    </rsweb:ReportViewer>
</div>
<div id="TotalCountry" align="center" runat="server" >
    <rsweb:ReportViewer ID="ReportViewer_TotalCountry" runat="server" >
    </rsweb:ReportViewer>
</div>

当您想将ReportViewer Visibility中的任何一个设置为TrueFalse时,请尝试设置Div可见性。

注:Not forget to use runat="server" under div tag .

希望你能理解并为你工作。