Hide ReportViewer until render RRS feed

  • Question

  • User1631074036 posted

    For many of the pages I build, I don't wish to have the ReportViewer visible until firing an event such as a button click. Using .Net 4.0 and ReportViewer10, however, throws the error "Message: Sys.ArgumentNullException: Value cannot be null. Parameter name: panelsCreated[1]" if you try to keep a panel containing the ReportViewer hidden until after a button click.

    Since I couldn't find much about this topic online, I'd basically been working around this for some time until I figured out today that if you reset the ReportViewer ReportPath in the code behind in the button click (even if it's the same path as in the aspx page), you can successfully keep the ReportViewer hidden until the button click. Hope this saves someone the frustration I've had.

    Wednesday, January 12, 2011 11:20 AM


  • User1471008070 posted


    Since you don't want to display the reporviewer control when load  the page, you could hide the reportviewer by setting its visible property. Such as

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

    Put all the code relevant to processing the report into the button click event including below code:

    ReportViewer1.Visible = True;

    Challen Fu


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 17, 2011 7:39 AM