[SOLVED] AspNetWrapper with DevExpress WebDocumentViewer


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.


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.


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.


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.


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

Thank you very much in advance.


  • You must to post comments
Best Answer

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.



  • You must to post comments

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

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

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 4 results
Your Answer

Please first to submit.