Compartilhar via


Report Viewer Control - Reset() method

This post is about a consequence of the calling ReportViewer.Reset() method related to revaluating parameter default values.   

The Report Viewer controls are a great way to integrate reports into your applications.  You can see some examples here:

https://www.gotreportviewer.com

One aspect of using the controls that may not be easily found/understood is the value of the Reset() method.

https://msdn2.microsoft.com/en-us/library/microsoft.reporting.winforms.reportviewer.reset(vs.80).aspx

https://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.reportviewer.reset(VS.80).aspx

The description of the method obsurely references to resetting the control to the 'default state'.  This has an implication in the case of parameters - when you reset the control, you create a new 'session' if connected to the report server.  This causes the report to be reexecuted when you run it.  It also means that the parameter values will be reset to their initial defaults.  Once done, you can again customize the parameter values in your code. 

Take care and good luck,

-Lukasz