Open window with pdf or html content from disk (external to iis)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Open window with pdf or html content from disk (external to iis)

    Hello!
    i need open document from external path my server in new window..
    on my grid i have command column and after click pass in direct event 2 param : ext ( pdf or html) and full path to them

     <ext:CommandColumn ID="CommandColumn1" runat="server" Width="60" >
                            <PrepareToolbar Fn="prepareToolbar" />
                              <Commands>
                                   <ext:GridCommand Icon="Page" CommandName="View">
                                               <ToolTip Text="Посмотреть" />
                                    </ext:GridCommand>
                                </Commands>
                           
                           <DirectEvents>
                               <Command OnEvent="ShowDoc"  Success="onAfterShowDoc"  IsUpload="true" >
                                  <%--  <EventMask ShowMask="true"  />--%> 
                                            <ExtraParams>
                                                <ext:Parameter Name="ext" Value=record.data.col6 Mode="Raw" />   
                                                <ext:Parameter Name="link" Value=record.data.col1 Mode="Raw" />
                                            </ExtraParams>
    
                               </Command>
                           </DirectEvents>
    on the server side i found 2 examples..
    this work for me.. but open dialog - where i must select open or save..


      protected void ShowDoc(object sender, DirectEventArgs e)
        {
    
            string ext = e.ExtraParams["ext"];
            string link = e.ExtraParams["link"];
       
         FileInfo file = new FileInfo(link);
            // Checking if file exists
            if (file.Exists)
            {
                Response.ClearContent();
                Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
                Response.AddHeader("Content-Length", file.Length.ToString());
                if (ext == "pdf")
                    Response.ContentType = "application/pdf";
                else
                    Response.ContentType = "application/html";  
                Response.TransmitFile(file.FullName);
                Response.End();
            }
        }
    and two examples - open content in window ( the same what i want)

      protected void ShowDoc(object sender, DirectEventArgs e)
        {
    
            string ext = e.ExtraParams["ext"];
        
            string link = e.ExtraParams["link"];
     
    
               var win = new Ext.Net.Window()
                {
                    ID = "newDocument",
                    Title =ext,
                    Width = Unit.Pixel(1000),
                    Height = Unit.Pixel(600),
                    Modal = true,
                    Collapsible = false,
                    Maximizable = true,
     
                    BodyStyle = "padding:10px;",
                    AnimateTarget = sender.ToString(),
                    Icon = Icon.PageWhiteAcrobat,
                    Loader = new ComponentLoader
                    {
                        Url = link, // this link only internal for IIS.??. i want  open from net share path.. html and pdf file
                        Mode = LoadMode.Frame,
                        LoadMask = { ShowMask = true },
                        MonitorComplete=true
                    }
          
             };
               win.Render(this.Form1);
           }
    may be help me edit 2 example.. if link to file inside server ( like 1.pdf) this work fine, but if link="G:\wert yuio\asdd 2323\232 555.pdf " - not open..
    thanks..
    Last edited by asics167; Jan 10, 2014 at 4:27 AM. Reason: edit proc 2

Similar Threads

  1. [CLOSED] [#316] Window content disappears when moved
    By vadym.f in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Jan 22, 2015, 10:44 AM
  2. Replies: 0
    Last Post: Jul 31, 2013, 3:23 AM
  3. [CLOSED] Force a external Page to open in a Window
    By Peter.Treier in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 13, 2013, 10:02 AM
  4. Replies: 3
    Last Post: Aug 21, 2012, 11:43 AM
  5. Replies: 1
    Last Post: May 28, 2010, 1:13 PM

Posting Permissions