Reputation: 53
I have problem with the report viewer.If I set my report viewer as visible=false
in page_load page on event button click, if i already set as visible=true
, it still make the reportviewer visible= false
. Can anyone help me with this problem? or is there any other solution..i have 2 reportviewer in a aspx page and i need one of it to be visible=false
in page_load. here's the code..thank youuu
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;
}
as you can see,when i click btn_AllCountry_Click
, the
ReportViewer_TotalCountry.Visible = true
; ill remain visible=false :(
help me..i'm new to this reporting :'(
<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>
Upvotes: 0
Views: 4996
Reputation: 41
On few reports I use :
rptViewer.ShowReportBody = false;
on Page_Load
and
rptViewer.ShowReportBody = true;
on button_click
.
I think it solves your problem.
Upvotes: 2
Reputation: 5636
I have a solution for this type of problem, hope you like, Instead of setting Visibility
of ReportViewer
. Try to set Visibility
of your Div
control like
<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>
When you want to set Any of ReportViewer Visibility
to True
or False
then instead of this try to set Div
Visibility.
Note: Not forget to use runat="server" under div tag
.
Hope you understand and works for you.
Upvotes: 0