I have a reportviewer control in remote mode which loads a report that has nine parameters. Under certain conditions, I want to limit the options of one of those parameters (a dropdown list) in the report. If I do this:
protected void Page_Load(object sender, EventArgs e)
{
var rpt = ReportViewer1.ServerReport;
var param = rpt.GetParameters()[3];
var option = param.ValidValues[0];
param.ValidValues.Clear();
param.ValidValues.Add(option);
}
then the first time I load the page, only that single option appears. When I click the run report button and the report refreshes, all of the original options are back in the list, and I receive an index out of range error in the report.
Is it possible to do this in the page code?