PROBLEM: Report parameters can not be set. Default values always take priority.
I am trying to create a report with parameters which are prompted by the user and are initially populated with default values. However, whenever I edit the parameters in Report Viewer and click 'View Report', the parameter values revert to their default value. The user-specified parameters never "stick". Please help! The xml looks like this: <ReportParameters> <ReportParameter Name="ConnectString"> <DataType>String</DataType> <Prompt>ConnectString</Prompt> <Hidden>true</Hidden> </ReportParameter> <ReportParameter Name="FromDate"> <DataType>DateTime</DataType> <DefaultValue> <Values> <Value>2006-1-1</Value> </Values> </DefaultValue> <AllowBlank>true</AllowBlank> <Prompt>From:</Prompt> </ReportParameter> <ReportParameter Name="ToDate"> <DataType>DateTime</DataType> <DefaultValue> <Values> <Value>2006-12-31</Value> </Values> </DefaultValue> <AllowBlank>true</AllowBlank> <Prompt>To:</Prompt> </ReportParameter> </ReportParameters>
December 5th, 2006 4:09pm

One more observation: It works within Report Manager. The problem is when the report is hosted in my application. It seems there might be something in my code that is causing the user-specified parameters to be ignored. I tried eliminating SetParameters call for the one hidden parameter, and I made sure I was setting ShowParameterPrompts attribute once (in case changing value would reset parameters). The problem still exists.
Free Windows Admin Tool Kit Click here and download it now
December 5th, 2006 5:03pm

One possible cause is that you are setting the report path or report server url after the LoadViewState event on the postback. If you do this, the report viewer control will see this as a change in the report definition and reload the report from the server, ignoring any input from the postback because it applies to the "old report". Try setting the report path/server url during OnInit, or only when Page.IsPostBack is false.
December 7th, 2006 6:49am

Thank you Brian! That worked! I verified that eithersettingServerReport properties inOnInit(), or after checking Page.IsPostBack is false in Page_Load(), will fix this problem. I also had to call SetParameters within these same constraints. On to new problems...
Free Windows Admin Tool Kit Click here and download it now
December 7th, 2006 4:19pm

Been chasing my tale for 3 days. I know this is an old post but thank you.
February 11th, 2012 11:56am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics