I have run the the update to SP26 for some reason my parameters are no longer showing up in the parameter panel on the web crystalreportviewer after the report has initially loaded. The parameter(s) is prompted initially to run the report.
As a work around I have set HasToggleParameterPanelButton= false, HasRefreshButton=true, and ReuseParameterValuesOnRefresh=false.
<CR:CrystalReportViewer ID="Report" Runat="server" AutoDataBind="true" Height="1250px" HasCrystalLogo="False" HasRefreshButton="True" HasToggleParameterPanelButton="false" BestFitPage="True" ReuseParameterValuesOnRefresh="false" ToolPanelView="None" DisplayStatusbar="True" HasToggleGroupTreeButton="false" EnableDatabaseLogonPrompt="False" PrintMode="ActiveX" />
This does show the parameter(s) as expected. My report parameters are set to editable and when you loop through the parameterfield using the code below the Usage2 values is already set to all the available values (side note, this snip came from another post, but if you try it you will get a Not Supported exception)
foreach (CrystalDecisions.Shared.ParameterField parameterField in reportDocument.ParameterFields)
{
parameterField.ParameterFieldUsage2 = ParameterFieldUsage2.ShowOnPanel;
}
As you can see from pic here the parameter for this report is missing from the Parameter Panel. Not sure how to fix this issue. Any suggestions would be appreciated. Thinking it might be a bug. I included my code below for reference. Prior to SP25 I was clearing the parameterfieldinfo property using Report.ParameterFieldInfo.Clear() in the report init method. This might have something to do with the missing parameters, but I have no way of testing, because if I add that back I cannot get the report to load as when you click the OK on the parameter dialog the report's ajax postback just returns the parameter dialog back instead of the rendered report.

Private crReportDoc As ReportDocument
Private rpt As String
Private Sub Report_Init(sender As Object, e As System.EventArgs) Handles Report.Init
Dim exportFormatFlags As Integer = CInt(CrystalDecisions.[Shared].ViewerExportFormats.PdfFormat Or CrystalDecisions.[Shared].ViewerExportFormats.ExcelFormat)
Report.AllowedExportFormats = exportFormatFlags
'Report.ParameterFieldInfo.Clear() 'started causing prompt to not go away if set 'removed 12/13/19 CR SP25 & SP26
LoadCRV()
End Sub
Sub LoadCRV()
Try
rpt = Request.QueryString("rpt")
If rpt Is Nothing Then Response.Redirect("~/reports/crm.aspx")
Dim rptPath As String = Nothing
If rpt IsNot Nothing Then rptPath = Server.MapPath("~/reports/cr/" + rpt)
If rptPath IsNot Nothing Then
Try
crReportDoc = New ReportDocument
crReportDoc.Load(rptPath)
For Each rd As ReportDocument In crReportDoc.Subreports
crDBLogin(rd)
Next
crDBLogin(crReportDoc)
Report.ReportSource = crReportDoc
Report.RefreshReport()
Catch ex As CrystalReportsException
Catch ex As Exception
End Try
End If
Catch ex As Exception
End Try
End Sub
Private Sub cr_Unload(sender As Object, e As System.EventArgs) Handles Me.Unload
If rpt IsNot Nothing Then
If crReportDoc IsNot Nothing Then
If crReportDoc.Subreports IsNot Nothing Then
For Each srDoc As ReportDocument In crReportDoc.Subreports
If srDoc IsNot Nothing Then
srDoc.Close()
'srDoc.Clone() 'idea from web post
srDoc.Dispose()
GC.Collect()
'GC.WaitForPendingFinalizers() 'idea from web post
End If
Next
End If
crReportDoc.Close()
'crReportDoc.Clone() 'idea from web post
crReportDoc.Dispose()
GC.Collect()
'GC.WaitForPendingFinalizers() 'idea from web post
End If
If Report IsNot Nothing Then
Report.Dispose()
End If
End If
End Sub
Notes about my upgrade:
I ran the exe as the admin as instructed. I let it install the 64bit msi. The 32bit msi was already installed, but did not get updated. I updated it manually. The VS toolbox still has the .3500 controls referenced so I removed them and added the new items (not sure if that was suppose to happen automatically). I did remove all my references in the image below and added them back which updated the project file to the .4000 dll's.
Project Specs
x86, 4.7.2 framework

Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Search for the KBA number at the end of the url, google will find it.
Please test it first.
Also, don't post the same question again...
If it's that important purchase an incident:
Community is low priority for SAP support, when I have time I come here.
This is not a support site where you can request a screen share or direct contact.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
don.williams I am back. 🙂 Sorry for my previous comment, just got frustrated.
Okay, so here are some details that are relevant to our discussion.
After reading several items online related to using session to store the report, one critical footnote seems to be missing in KBA 1985571. If you are using a database or ASP.NET State Service for managing session, then serialization of the ReportDocument object will not work correctly. I am using ASP.NET State Service so that explains why was haven't been able to get the examples working. However, I was able to implement Caching which does seem to work and I made it session unique. I will show code at the end of my comments.
Unfortunately, even when I loaded the report from the cache I was still being prompted for the optional parameters when initiating a postback from the viewer (ie: zoom, page nav, etc). Now, if I move my report loading code from the Page_Init method to the Page_Load method, then the optional prompts do not show up as you would expect and you are free to set them via the ParameterPanel.
However, if I implement the report loading in the Page_Load method you end up breaking the built-in report page navigation buttons. If you had a 7 page report, then you cannot navigate past page 2. You can navigate to those pages manually using the page dropdown. So it is just the previous and next page buttons that don't work. If you look at the code below you will see that the viewinfo property is correct before you set the value for viewer.reportsource. Once you set the reportsource back to the cache the viewinfo is reset and when the Navigate method is then fired the values for current page and previous page are both 1.
Now, if you leave the report loading in the Page_Init the built-in page next and previous navigation buttons work, but only for reports that do not have optional parameters.
I have seen a few example where people have wrapped the viewer.reportsource in a IF Not IsPostback conditional and this does not work because if you do this then you get a Database Login Failed error.
So Page_Load gets rid of the optional parameter prompt, but breaks next and previous navigation when setting reportsource on postback but you cannot not do that or you get a Database Login Failed
Page_Init the next and previous buttons work when the report does not have any optional parameters.
Private rpt As String
Private rd As ReportDocument
Private Sub cr_Init(sender As Object, e As EventArgs) Handles Me.Init
rpt = Request.QueryString("rpt")
If rpt Is Nothing Then Response.Redirect("~/reports/crm.aspx", False)
If Session("ReportName") IsNot Nothing Then
If Session("ReportName") <> rpt Then
Session("ReportName") = rpt
End If
Else
Session("ReportName") = rpt
End If
If rpt IsNot Nothing Then
'my clever way of setting the name of the export file :)
crReportViewer.ID = rpt.Replace(".rpt", "")
End If
LoadReport()
End Sub
Private Sub cr_Load(sender As Object, e As EventArgs) Handles Me.Load
'LoadReport()
End Sub
Private Sub LoadReport()
If Session("ReportName") IsNot Nothing Then
Dim reportName = Session("ReportName").ToString()
Dim cachedReport As String = reportName + Session.SessionID
If Cache(cachedReport) Is Nothing Then
rd = New ReportDocument
rd.Load(Server.MapPath("~/reports/cr/" + reportName))
For Each srd As ReportDocument In rd.Subreports
crDBLogin(srd)
Next
crDBLogin(rd)
Cache.Insert(cachedReport, rd, Nothing, DateTime.MaxValue, TimeSpan.FromMinutes(20))
Else
rd = CType(Cache(cachedReport), ReportDocument)
End If
Dim vi As ViewInfo = crReportViewer.ViewInfo
'vi.PageNumber is right untill reportsource is set on page navigation postback and thus wrong when navigate event is fired
'If Not IsPostBack Then
crReportViewer.ReportSource = rd
' End If
End If
End Sub
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.