[SOLVED] AspNetWrapper with DevExpress WebDocumentViewer

Answered
0
0

Hello everyone,

we are migrating our reporting module from VisualWebGui to WiseJ.
While doing so, we encountered a problem with the AspNetWrapper.  Even though i am not 100% sure this is related to Wisej i wanted to see if you encountered a similar problem and might know a solution.

Use-case

Our use-case is a reporting module which features a panel with multiple filters, that contains an AspNetWrapper that wraps the DevExpress ReportViewer (ASPxWebDocumentViewer). Once the user selects the parameters and report type a different report gets loaded into the report viewer.

This way we can switch between the different reports at runtime without reloading the whole page.

Problem

Until now we achieved this by calling the LoadReport() method followed by the CreateDocument() method.
When using this approach in WiseJ, we encountered multiple problems.
While the first report loads without problems, it is no possible to change the report again.
The report does get changed in the backend, but the frontend does not reflect the change.

When calling Application.Update() oder <ViewerControl>.Update(), the report disappears completely.

I suspect the problem is related to the ASP RequestCycle.

Questions

So the question now is: Will it be possible to realize our use-case with WiseJ?
If so, is the AspNetWrapper capable of achieving this or do we have to use a different approach?
If it is possible with the AspNetWrapper, please tell us how we can improve our approach.

Sample

I created a sample application that will hopefully show the problem. Please find the application in the attachments.

Thank you very much in advance.

 

Attachment
  • You must to post comments
Best Answer
0
0

Just looked at your sample app. The problem is that you are saving the WrappedControl reference which is invalid right after the first cycle.

Then in OpenReport() you call CreateHostedControl() which creates an instance of the ASP.NET control that is not related to the request.

Do this:

  • In AspNetWrapper<ASPxWebDocumentViewer>.OnLoad call this.WrappedControl.OpenReport(this.report);
  • In AspNetWrapper<ASPxWebDocumentViewer>.OpenReport() save the report in this.report and call Update() to refresh the page.

Remember NOT to save this.WrappedControl, and that you can affect the ASP.NET control only when processing the page events exactly like in an ASP.NET page.

Basically when processing Wisej events is like if in ASP.NET you started a parallel thread and tried to change the ASP.NET control from an independent thread: ASP.NET simply cannot handle it.

Source code for the AspNetWrapper is here.

A complex example is here.

 

 

  • Ngabo Adrian
    Dear Luca, I know this may be late but it seems helpful to me if I understand the concept. Can you help me know how to do those two steps you’ve mentioned above in vb.net especially the second step that involves saving the report. I downloaded Florian Bogner’s sample and it seemed to work well on my side. The report is rendered well but then it is in unending/reloading loop of report viewer’s LoadComplete method. In my case, I’m not switching between reports rather supplying a report with different dataSources at runtime. But there is an unending loop which keeps the report being reloaded every after few seconds. Your support will be a paramount importance in this regard. Thank you.
  • You must to post comments
0
0
How can I set the default pageview to multiple in ASPxWebDocumentViewer.
  • Luca (ITG)
    Please refer to the DevExpress documentation. If there is an issue related to Wisej, attach a runnable small sample that shows the problem, clearly indicates what you are trying to do, and link all the DevExpress documentation sources and examples you used to implement your solution.
  • You must to post comments
0
0

Hello Luca,

thank you very much for taking the time to analyse the problem and for providing a solution.

The reportviewer is now working perfectly again.

 

  • You must to post comments
0
0

The issue is most likely the ASP.NET page cycle. Remember that ASP.NET controls on the server side do not exist outside of the request/response cycle. The instances are all destroyed and recreated from scratch on every request. If you save a reference to ASP.NET control it simply won’t work.

If you are changing any property of the ASP.NET control while processing a Wisej event it will also not work because the ASP.NET control either doesn’t exist or the instance is invalid. You have to save the values in the wrapper control and then issue an update which will cause the ASP.NET page to reload and fire all the page cycle events (Init, Load, etc) and it’s only in those events that you can interact with the ASP.NET control and update its properties using the values you cached in your wrapper.

This is why it’s hard to write real time web apps with ASP.NET or any page/html/request based web framework.

BTW, The UpdatePanel in ASP.NET is also a full page cycle request, parsing, etc.

 

  • You must to post comments
0
0

Hello again,

please let me know if you need further details to reproduce the problem,
or if i am able to clarify some points.

Best regards,
Florian Bogner

 

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.