2
Load DocumentUltimate in iframe
Question asked by Jari Nieminen - 8/18/2017 at 12:00 AM
Answered
How can I load documentviewer in iframe instead of @Html.RenderControl(documentViewer)?

1 Reply

Reply to Thread
0
Cem Alacayir Replied
Employee Post Marked As Answer
  1. Create a new view ViewDocument.cshtml which only renders the DocumentViewer. Get the file (or some kind of ID) from the querystring or pathinfo and then set documentViewer.Document property to that for this View. So when the view is called with different parameters, it should load that intended document:
     
    @using GleamTech.Web
    @using GleamTech.Web.Mvc
    @using GleamTech.DocumentUltimate.Web
    
    @{
        var documentViewer = new DocumentViewer
        {
            FullViewport = true,
            Document = Request.QueryString["d"]
        };
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <title>View Document</title>
        @Html.RenderCss(documentViewer)
        @Html.RenderJs(documentViewer)
    </head>
    <body>
        @Html.RenderControl(documentViewer)
    </body>
    </html>
     
  2. In your main page, put an <iframe> element and change the src of this iframe whenever required (e.g. when user clicks on grid rows). You should simply append the document name or ID to the viewer url  as querystring or pathinfo:
     
    <iframe  src= "ViewDocument?d=SomeFile.doc" width="800"  height="600" style="border: 1px solid #d0d0d0"  allowFullScreen webkitallowfullscreen mozallowfullscreen>
    
     

Reply to Thread