Creating a report with both a dynamic query and working query groups

I’ve produced an SSRS report with a query as it’s data provider, however, I need to be able to edit this query following the running of the dialog but before the report runs. I’ve tried to achieve this using the SRSReportRun class but I get the problem that on the dialog the parameters don’t appear in their correct parameter groups.

Alternatively I’ve run this report using SRSReportRunController which displays the parameters in their correct groups but I don’t know how to then retrieve, edit and then load the query back into the report based on the parameter content.

Could anyone suggest a plan of action here? On most reports I used a report data provider and am able to do processing in there but I can’t really do this as the client absolutely has to have the ability to edit the query themselves from the dialog.