0

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

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_Click; ReportViewer_TotalCountry.Visible = true生病仍然可见=假 :(

帮帮我..我是这个报告的新手:'(


 <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>
4

2 回答 2

2

在我使用的几份报告中:

rptViewer.ShowReportBody = false;Page_Load

rptViewer.ShowReportBody = true;button_click

我认为它可以解决您的问题。

于 2013-05-29T12:40:12.303 回答
0

对于这类问题,我有一个解决方案,希望你喜欢,而不是设置Visibility. ReportViewer尝试设置Visibility您的Div控件,例如

<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>

当您想将 Any of 设置ReportViewer VisibilityTrueFalsethen 时,请尝试设置DivVisibility。

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

希望您理解并为您工作。

于 2013-05-17T07:41:00.067 回答