Trigger when document is loaded in a razor page?

Discussions about DocuVieware integration in GdPicture.NET.
Post Reply
User avatar
Posts: 4
Joined: Wed Jan 25, 2017 8:35 pm

Trigger when document is loaded in a razor page?

Post by JocPihl » Wed Jan 25, 2017 8:59 pm


I'd like to trigger a javascript function when my document is loaded in DocuVieware. I tried my usual jquery when document is loaded. But that's not really working in this case. I want to do a PostCustomServerAction when my document is loaded and load existing annotations and a few other things. I am using Asp.Net MVC and razor.

I initiate the DocuVieware from my Razor page with:

Code: Select all

docuVieware.LoadFromStream(new MemoryStream(Convert.FromBase64String(ViewBag.FileAsBase64)), true);
docuVieware.RenderControl(new HtmlTextWriter(this.Output));
So what's the best way to trigger my own java function:

Code: Select all

<script type="text/javascript">
    function OnLoadDocumentSuccess() {
        DocuViewareAPI.PostCustomServerAction("DocuVieware1", true, "setDefaultValues");
Jocke Pihlström
Alcom System AB

Posts: 263
Joined: Sun Sep 02, 2012 7:30 pm

Re: Trigger when document is loaded in a razor page?

Post by Cedric » Thu Feb 16, 2017 4:41 pm


Why not simply use the built-in NewDocumentLoaded event?

All you would need to do is subscribe to the even in the Application_Start part of your Global.asax.cs with something like this:

Code: Select all

DocuViewareEventsHandler.NewDocumentLoaded += NewDocumentLoadedHandler;
NewDocumentLoadedHandler being the code you want to execute when a new document is loaded.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests