Skip to main content Skip to footer

Handling Parameters in C1SSRSDocumentSource

Reporting without the ability to pass parameters is like a King without a Kingdom :P. With the advent of C1SSRSDocumentSource, it is possible to fully control the Parameters of SSRS Reports loaded in it. C1SSRSDocumentSource allows you to load an SSRS report into a C1PrintPreviewControl for viewing and exporting to a variety of formats including Adobe PDF, Microsoft Word and Excel. In addition to this, C1SSRSDocumentSource makes it possible to get/set the values of parameters in SSRS Report at runtime. We can even suppress the default parameter dialog box and assign our own customized dialog box to set the values of parameters.

Setting the value of SSRS Report Parameters at Runtime

Parameters collection of C1SSRSDocumentSource can be used to set the value of individual parameters of the report. Parameters collection can be initialized in the Open method. After this call it is possible to access the list of parameters, or generate the document to fill the pages. Further, ApplyParameterValues method can be used to apply parameter values specified in Parameters collection as current values.

c1SSRSDocumentSource1.Parameters[1].Value = 120;  

Suppress the Default Parameter Dialog Box

The default Parameters dialog box won't appear on program run if the SSRS report assigned to the Document property is already generated. Using this, parameter values can be assigned at runtime without showing the parameter dialog box.

c1PrintPreviewControl1.PreviewPane.Document = c1SSRSDocumentSource1;

Assign Values of SSRS Parameters through Customized Parameter Dialog Box

Using the approaches mentioned in the above points, a customized parameter dialog box can be shown in place of a default parameter dialog box. Using the values assigned in Customized parameter dilaog box, the parameters collection of C1SSRSDcoumentSource can be set and the report is further generated to be displayed in C1PrintPreviewControl.


Updating SSRS Parameters

SSRS_ParameterSince 2015V1, with the new non-paginated mode, a new button 'Report Parameters' has been added in C1PrintPreviewControl's toolbar. This will enable users to open the Parameter UI, re-set the parameters and reload the report again.

Note: The above mentioned functionalities will work with the build 2/4.0.20151.49 onwards.

Working Samples

Download Sample - VB Download Sample - CS What's new in C1PrintPreviewControl 2015-V1, know here.


comments powered by Disqus