on 12-13-2019 4:42 PM
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
Here's the KBA and Incident numbers:
2889303 - Crystal Reports for Visual Studio SP 26 - Next Page causes Optional Parameter to prompt for value
Incident 89393 / 2020 / Paging causes Optional Parameter to prompt each time
Expected to be released in SP 27 due out in April, maybe... no date set at this time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SP 27 is now available...
Have a great day
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kevin,
I ran out of time getting the image update to date but I ping my Developer in R&D and he tested it as well and confirmed it works in BOE .NET but not in CR for VS so it is a regression issue.
We'll try to get it fixed in SP 27.
I'll update this post with the KBA and Incident number I create once I get it done...
Thanks for your patience... You can let your users know it will be fixed and an update should be out in April if all goes well...
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kevin,
I did but Paid cases come first. This is a community and free so it's on the bottom of the list for to get to...
I did some more testing, I used VB and added postback and sessions and I too am getting the same thing.
So I'm getting a new image running and will install SP 21 and see what happens, to see if it's a regression issue or something because we changed the Flash component.
I'll ping R&D but they are in Shanghai and due to the epidemic over there they are not responding and all still home for the Chinese New Year holiday.... may be a week before I hear anything back from them....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kevin,
Changing it back is not under our control, that is a specification by Microsoft as defined by the Page_Load and Page_Init.
A good explanation of how it works is here:
https://docs.microsoft.com/en-us/previous-versions...
Load should be used to preload all of the default's including PostBack methods and does not get called when you page through a report so the initial values are used. Page_Init refreshes the cached page and applies the update values, so it stays in scope. Otherwise the same values or no values are passed through the CR Next/Previous Page events.
If I get some time next week I'll do some testing as well, no one else has reported this being a problem so it's likely environmental.
Are you setting All CR Properties including log on properties in the Page_Init as well?
Try a simple test app and just page through it, with the viewer in the Page_Init section it should prompt for log on info once and then simply page through the report using Sessions/PostBack in the Page Init.
Actually if you just use these 3 lines in the Page_Init section it should prompt you for the dB log on info and then the Parameter values and then simple page through the report..
Looking closer at your test app I see now you are not using the Engine to load the report but simply using the Viewers Load event.
I'll have to find some old samples and see if does the same thing...
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey don.williams hope all is well. I had to step away from this for a few days. I wanted to answer your question on the CR properties. I just ran through my code and everything is in the page_init. See code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web
Partial Public Class cr
Inherits System.Web.UI.Page
Private rpt As String
Private rd As ReportDocument
Private Sub cr_Init(sender As Object, e As EventArgs) Handles Me.Init
Dim exportFormatFlags As Integer = CInt(CrystalDecisions.[Shared].ViewerExportFormats.PdfFormat Or CrystalDecisions.[Shared].ViewerExportFormats.ExcelFormat)
crReportViewer.AllowedExportFormats = exportFormatFlags
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
Session("Report") = Nothing
End If
Else
Session("ReportName") = rpt
End If
If rpt IsNot Nothing Then
crReportViewer.ID = rpt.Replace(".rpt", "")
End If
LoadReport()
End Sub
Private Sub cr_Load(sender As Object, e As EventArgs) Handles Me.Load
'LoadReport() ''''not using this currently
End Sub
Private Sub LoadReport()
If Session("ReportName") IsNot Nothing Then
Dim reportName = Session("ReportName").ToString()
Dim cachedReport As String = reportName + Session.SessionID
If Session("Report") 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)
Session("Report") = rd
'Cache.Insert(cachedReport, rd, Nothing, DateTime.MaxValue, TimeSpan.FromMinutes(20))
Else
rd = CType(Session("Report"), ReportDocument)
End If
If rd.ParameterFields.Count = 0 Then
crReportViewer.ToolPanelView = ToolPanelViewType.None
End If
crReportViewer.ReportSource = rd
End If
End Sub
Sub crDBLogin(ByVal rptDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument)
Try
Dim crCI As New CrystalDecisions.Shared.ConnectionInfo
With crCI
.ServerName = System.Configuration.ConfigurationManager.AppSettings("sqlserver")
.DatabaseName = System.Configuration.ConfigurationManager.AppSettings("database")
.UserID = System.Configuration.ConfigurationManager.AppSettings("user")
.Password = System.Configuration.ConfigurationManager.AppSettings("pwd")
.Type = CrystalDecisions.Shared.ConnectionInfoType.SQL
.IntegratedSecurity = False
End With
For Each crTable As CrystalDecisions.CrystalReports.Engine.Table In rptDoc.Database.Tables
Dim li As CrystalDecisions.Shared.TableLogOnInfo = crTable.LogOnInfo
li.ConnectionInfo = crCI
crTable.ApplyLogOnInfo(li)
Next
rptDoc.VerifyDatabase()
Catch ex As CrystalDecisions.Shared.CrystalReportsException
End Try
End Sub
Private Sub cr_Unload(sender As Object, e As System.EventArgs) Handles Me.Unload
If crReportViewer IsNot Nothing Then
crReportViewer.Dispose()
End If
End Sub
End Class
Based on my production code I am using the Engine. I am also using a method to logon to the database and set the EnableDatabaseLogonPrompt property to false on the viewer control.
<%@ Page Language="vb" AutoEventWireup="true" CodeBehind="cr.aspx.vb" Inherits="MJHCRM.cr" %>
<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<!doctype html>
<html lang="en">
<head>
<title>Report Viewer</title>
</head>
<body>
<form id="crForm" runat="server">
<CR:CrystalReportViewer
ID="crReportViewer" Runat="server" AutoDataBind="True" Height="1250px" HasCrystalLogo="False" BestFitPage="True" DisplayStatusbar="False" ToolPanelView="ParameterPanel"
EnableDatabaseLogonPrompt="False"
HasRefreshButton="True"
ReuseParameterValuesOnRefresh="False"
HasZoomFactorList="False"
HasPrintButton="False"
HasDrillUpButton="False" HasDrilldownTabs="False"
Width="100%" BorderStyle="None" SeparatePages="True"
/>
<asp:HiddenField runat="server" ID="current_page" />
</form>
</body>
</html>
So I understand that you all cannot move your wiring up for the viewer back to the Page_Load method. I am thinking what happened is that the CR viewer development team overlooked how the optional parameters are loaded into state during the Page_Init. As I have stated and shown early on this thread the optional parameter state works correctly when moving my LoadReport method into Page_Load. However, when LoadReport is called from Page_Init the optional parameters get displayed on viewer postback (ie: next page, previous page, zoom, etc) I really just think the CR viewer developer team needs to give this a quick look. I just feel something to do with optional parameter state management was overlooked when migrating the code over to using Page_Init.
Thanks,
Kevin
Hi Kevin,
Shawn tracked this with R&D and they changed the Session type so it will not work with StateServer, we don't know why but it is by design now due to corruption of the session when it is used.
Only option is to not use that session type.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
don.williams so I have verified that the InProc session setting works, but unfortunately we have the same issue as above in regards to the optional parameters getting shown on postback of the viewer when the viewer reportsource is loaded in the Page_Init. If you set the reportsource in the Page_Load then you don't get the parameter prompt when the viewer sends a postback, but the previous and next button don't work. Now this could actually be a bug related to R&D moving the requirement to set the ReportSource in the Page_Init instead of Page_Load. Probably something R&D overlooked when the viewer is wired up. What do you think?
Hi Kevin,
That all makes sense and yes it is working as designed. MS changed the Page_Load and Page_Init, we used to use the Page_Load as default but now you do need to use the Page_Init to keep the report in scope.
I did some searching and found this in a KBA when we had a .NET version of our BOE Interface:
1729138 - Unable to serialize the session state in share point server
.....
Resolution
This error can happen if the asp.net process is in "StateServer" or "SQLServer" session mode.
To change this setting, you will need to find your web.config file for your SharePoint site and find the section titled "sessionState"
e.g.
<sessionState mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:4200"
cookieless="false"
timeout="120"/>
Change the mode to "InProc" and restart the asp.net worker process.
I'll check with Shawn, he's much more up on using Sessions and see if he has any suggestions...
He wrote that KBA but no explanation as to why you can't use it.
Other than that I suspect your only option is to not use StateServer.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
OK, I see what you are doing. I set both parameters values which is the way it should work.
What you are doing is leaving the param empty, even though your text says optional it's not.
CR still needs a value even though it's set as optional.
Next issue is because it's a parameter you need to use sessions and PostBack so when you page it uses the existing values and not prompt for new ones.
so you need to use this:
https://launchpad.support.sap.com/#/notes/1985571
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
don.williams the color parameter is an optional parameter prompt. Please look at the report and you will see this. I added that label in the report itself. See snip below. Crystal viewer should not need the optional parameter to load the report. If it did then you would not be able to click OK on the first parameter prompt that loads. Currently if you click OK without anything selected the built-in view just shows that the name parameter is required. If you select the name prompt the report does load when clicking OK.
Also, I cannot access the link you included. See snip below.
If you would like to jump on a screen share to discuss this further it might be helpful. Feel like we are just going back and forth. Let me know.
Thanks,
Kevin
Video link no longer works.
Your test app works for me so it's environmental on your system likely causing the problem.
Parameter prompts are handled by js files in the Viewer folder:
C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13\js
Note there is a new Parameter reference in the project you need to use. So remove the old Flash component from your references, then it should work again for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try video again please. Changed privacy setting.
Not using flash. What is parameter reference you are talking about?
Video shows the issue I’m experiencing. Hopefully you can view it and repeat the issue on your end.
Thanks,
Kevin
Hi Kevin,
Thanks for the test app andf the viewer warning.
So I copied the CR viewer folder into the AppData folder:
C:\inetpub\wwwroot\CrystalReportsWebSite12\CrystalReportsWebSite1\App_Data\crystalreportviewers13
It works for me:
Use Fiddler and see where it's trying to load the various CR resources from.
The JS file it's not finding is in here:
C:\inetpub\wwwroot\CrystalReportsWebSite12\CrystalReportsWebSite1\App_Data\crystalreportviewers13\prompting\js
Thanks again
Don
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 have made a quick video to make sure we are both on the same page. Still feel like we are looking at a bug here.
Thanks, Kevin
Yes, monitor the web server
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok don.williams I have run the processmonitor, but I have no clue what I am looking for. I ran it just on iisexpress and only when I clicked the next page button in the crystal report viewer and when it prompted for the optional parameters I clicked stop on the process montior. Captured 42000 events. Should I filter those events with just SAP in the path? I am going to start reviewing now just to see if I can find anything that makes sense.
Also, I added two additional notes to the main question. I am starting to believe this might a bug related to handling optional prompts (parameters). Thanks for the help so far!
don.williams so now I am really thinking this might be a bug with SP26. Will you please see if you can reproduce the optional prompt issue?
I have attached a sample project. (sample project here) This project was created using the crystal reports website template. I have one test.rpt file. Run the project and select the Name property only. Once report loads, then click next page. You should get a prompt for Color which is the optional parameter. If you just hit ok, then window closes but still on page 1. If you select a color it updates the report, but still on page 1. Only then can you click next page and page 2 will load.
My project is a web app and this a newer website project, so I am convinced it has to be a bug. Hopefully you will get the same results.
Don't forget to add the asp_net virtual directory to the vs/applicationhost.config file so the viewer loads. I also updated the physicalPath, but you might have to update that too if VS doesn't do it for you.
just add your EXE to the filter...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Theres's been updates to resources. Try ProcessMonitor and see what it's looking for.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using Sessions and Postback to keep the report in scope?
See this KBA:
https://launchpad.support.sap.com/#/notes/1985571
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Strange since I have never had an issue prior to SP25. Is this a new thing? Also, I tried setting my ReportDocument to the sesssion, but get this exception.
Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.
Caused By: System.NotSupportedException Not supported within subreports
Don't install the 32 bit MSI on your DEV PC, not required. Just install the EXE.
Make sure the Viewer was updated as well to 13.0.4000.0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Don, thanks for the response. I went ahead and uninstalled the 32 bit MSI. All references are using 13.0.4000.0. Removed all project references and added them back as instructed in the wiki. Here is my complete viewer code. I went ahead and switched HasToggleParam and ReuseParam values back to true and false, but the values still do not appear on the parameter panel.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="cr.aspx.vb" Inherits="MJHCRM.cr" %>
<%@ Register Assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<!doctype html>
<html lang="en">
<head>
<title>CR Viewer</title>
</head>
<body>
<form id="crForm" runat="server">
<CR:CrystalReportViewer ID="Report" Runat="server" AutoDataBind="true" Height="1250px" HasCrystalLogo="False" HasRefreshButton="True" HasToggleParameterPanelButton="true" BestFitPage="True" ReuseParameterValuesOnRefresh="true" ToolPanelView="None" DisplayStatusbar="True" HasToggleGroupTreeButton="false" EnableDatabaseLogonPrompt="False" PrintMode="ActiveX" />
</form>
</body>
</html>
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.