DocuVieware not working inside ASP Update Panel

Discussions about DocuVieware integration in GdPicture.NET.
Post Reply
Posts: 2
Joined: Wed May 16, 2018 11:34 pm

DocuVieware not working inside ASP Update Panel

Post by AJ1985 » Wed May 16, 2018 11:56 pm


I have simple treeview which displays the documents and when clicked on the node will display the document in DocuVieware. This code works if the treeview and docuvieware are not in the update panel(I have commented the code for update panel and the code works as expected), but if they are inside the update panel the docuvieware is not displaying the document not it is loading the docuvieware control.

Please help me if you know the solution for this issue.

Below is my code:

ASPX Page:
<form id="form1" runat="server">
<asp:ScriptManager runat="server"></asp:ScriptManager>
<%-- <asp:UpdatePanel runat="server" ID="up">

<asp:TreeView runat="server" ID="TreeView1" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged">

<cc1:DocuVieware ID="DocuVieware1" runat="server" Height="600px" Width="100%" />


Code behind:
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
var docbyte = from l in db.DocumentRepositories
where l.DocumentRepositoryId == Convert.ToInt32(this.TreeView1.SelectedNode.Value)
select l;
if (docbyte.Any())
FileStream stream = new FileStream(docbyte.First().FileLocationPath, FileMode.Open, FileAccess.Read);
DocuVieware1.LoadFromStream(stream, true, this.TreeView1.SelectedNode.Text);

User avatar
Site Admin
Posts: 5704
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: DocuVieware not working inside ASP Update Panel

Post by Loïc » Thu May 24, 2018 9:35 pm

For information here the answer provided by our support staff:
Hello Ajay,

Thank you for the updated project, I've been able to reproduce the issue you described and I've also been able to investigate further.

It turns out it actually works but the DocuVieware auto-generated initialization script does not run on its own in an update panel update postback.
When a DocuVieware control is embedded in a page it will generate its own initialization script called "loadControllerDocuVieware1" when named DocuVieware1 and run it when page is loaded.
This is due to how JavaScript behaves with this asynchronous panel loading page flow, the page load event isn't fired and that's why the control disappears (it is hidden until initialized).
I've been able to work around this issue to fix the problem quite easily though, it is just a matter of telling the update panel to take care of the DocuVieware initialization too.

Basically all you need to do is add a bit of JavaScript in your page to catch the end async postback event and force the initialization script to run at that time.
This is done using Sys.WebForms.PageRequestManager class that raises client events specific to asynchronous postbacks (because there is a ScriptManager control in the form).
So you can do something like this:

Sys.Application.add_init(function () {
var pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
pageRequestManager.add_endRequest(function () {

This will make sure the self initialization script is properly executed and everything should work as expected.
You will find attached the Default.aspx modified file I have made for reference.

GdPicture Team

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest