Blank Parameter Panel in Crystal Reports Viewer

你说的曾经没有我的故事 提交于 2019-12-13 07:40:16

问题


I'm building a web based (ASP .NET) application to display Crystal Reports. The reports itself have been build in Crystal Reports XI and I'm working in Visual Studio 2010. It's working but the Parameter Panel visible on the left of the report is blank, eg. it does not display any parameters even though the report has a few of them and the user is prompted to enter their values before the report is generated. I've found some information that this might be caused by an old version of Crystal Reports (XI) used to produce those reports and, indeed, a test report written in Visual Studio 2010 has its parameters shown correctly.

My question is: How can I make this to work without rewriting the reports once again? I tried to open up an existing report in Visual Studio and saving it, it gave me a warning that this the current version of the report is newer than the previous one, however it didn't solve the issue. Any ideas?


回答1:


You can programmatically change each parameter's panel settings.

You will need to enumerate the ParameterFields collection, changing each parameter's ParameterFieldUsage2 property:

string fileName = null;

ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(fileName, CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault);

foreach (CrystalDecisions.Shared.ParameterField parameterField in reportDocument.ParameterFields)
{
  parameterField.ParameterFieldUsage2 = ParameterFieldUsage2.ShowOnPanel;
}

CrystalReportViewer1.ReportSource = reportDocument;



回答2:


If report is designed in previous version, parameters VALUE OPTIONS "Show on (Viewer) Panel" are set to "Do not Show"; thats why parameters are not shown in panel. to solve this. Just edit every parameter and set this property accordingly 1. Do Not Show 2. Editable 3. Read Only




回答3:


I was able to suppress the parameters panel at run time using this code:

crViewer.ToolPanelView = ToolPanelViewType.None;

Hope that keeps someone else from wasting an hour on this :-)




回答4:


I seem to have found a solution to this problem (although it's not ideal). Basically, in Crystal Reports => 2008 or Crystal Reports for Visual Studio, by right - clicking on a parameter field we can choose Edit and then the 'Show on (Viewer) Panel' option (not available in Crystal Reports XI). Setting this to Editable or Read Only will show this parameter in the Parameter Panel (default is 'do not show'). If anybody has a better idea (better than editing all of the reports) then I'd be grateful.



来源:https://stackoverflow.com/questions/11647611/blank-parameter-panel-in-crystal-reports-viewer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!