Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hye, i always thinking why my report viewer does not visible true on event click even when I set it visible true. the report viewer will visible true if i not set it visible false on Page Load but set visible false on others event click.here's the code below.as you guys can see, only the Label1 will visible true on btnViewReport_Click but not the ReportViewer_TTFSSummaryBasedOnCountry. i hope someone can explain to me..i am new in this reporting. thanks :) p/s:this problems only happens in page load.

C#
protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindDdlCountryValue();
                Label1.visible = false;
                ReportViewer_TTFSSummaryBasedOnCountry.Visible = false;
                
            }
        }


C#
protected void btnViewReport_Click(object sender, EventArgs e)
        {
            ReportViewer_TTFSSummaryBasedOnCountry.LocalReport.Refresh();
            Label1.visible = true;
            ReportViewer_TTFSSummaryBasedOnCountry.Visible = true;
        }
Posted
Comments
Ezra Neil 14-May-13 23:07pm    
It's kinda hard to understand but I assume you want the report be visible when you click a button? Then try this. Make the page do postback upon clicking button and handle the report visible setting at page load event.
afiqdoherty 15-May-13 0:14am    
thanks for the reply @ezra neil..i've try that,but still not working.im sorry if its kinda hard to understand.let me simplify this :)
example:
protected void btnViewReport_Click(object sender, EventArgs e)
{
reportviewer2.visible = true;
ReportViewer_TTFSSummaryBasedOnCountry.Visible = false;
}

protected void btnViewReport2_Click(object sender, EventArgs e)
{
reportviewer2.visible = false;
ReportViewer_TTFSSummaryBasedOnCountry.Visible = true;
}
above code is work..

but if in this situation

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

ReportViewer_TTFSSummaryBasedOnCountry.Visible = false;

}
}
protected void btnViewReport2_Click(object sender, EventArgs e)
{

ReportViewer_TTFSSummaryBasedOnCountry.Visible = true;
}

the ReportViewer_TTFSSummaryBasedOnCountry.Visible = true; still visible as false.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900