Reputation: 13
I'm rendering server reports (remote processing mode) through the ReportViewer control, but I also need to save the list of parameters each report has. The ReportViewer automatically generate the parameter-prompts for each report it's rendering, so I'm wondering if there's an event or properties that could allow me to access these parameter-prompts to obtain the name and number of parameters of the report?
Upvotes: 1
Views: 4294
Reputation: 39777
You can do it via call to "SetParameters" method. Here's a sample code (VB.NET):
Dim aParamList As New Generic.List(Of ReportParameter)
aParamList.Add(New ReportParameter("ParamName1", "Parameter Value 1"))
aParamList.Add(New ReportParameter("ParamName2", "Parameter Value 2"))
ReportViewer1.ServerReport.SetParameters(aParamList)
If you don't know parameter names, to get them from the report you can use "GetParameters" method:
For Each oParamInfo In ReportViewer1.ServerReport.GetParameters
'oParamInfo.Name would hold parameter name
Next
Upvotes: 2