This is a migrated thread and some comments may be shown as answers.

Custom ProgressArea not disappearing

1 Answer 93 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
David S
Top achievements
Rank 1
David S asked on 28 Jul 2008, 08:00 PM
Hello,

I am using a custom progress area after a process which processes a file and then allows the user to download the file.  I am able to display the progress area however it does not disappear once the file is ready for download.  I have tried using the client-side 'hide' function and 'cancelReqeust' function however they do not work.  Attached is the code to generating the file and updating the progressArea:

        public void ExportClicked(string mappedBinPath, string mappedImagePath) 
        { 
            ArrayList getFilesToProcess2 = new ArrayList(); 
            getFilesToProcess2 = GetFilesToProcess(); 
 
            if (getFilesToProcess2 == null) 
            { 
                return; 
            } 
 
            // We want the client-side to recognize the upcoming file as a zip file. 
            _view.PageResponse.ContentType = "application/exe"
            _view.PageResponse.AddHeader("Content-Disposition", "attachment; filename=CMIS.exe"); 
        
            XceedSfxPrefix sfx = new XceedSfxPrefix(new DiskFile(mappedBinPath + "xcdsfx32.bin")); 
 
            sfx.DialogStrings[DialogStrings.Title] = "Crown Managment Information System Extraction utility"; 
            sfx.DialogMessages[DialogMessages.Introduction] = "Crown Managment Information System Extraction utility. Please click 'Continue' to proceed extracting case files to your computer."; 
            sfx.DefaultDestinationFolder = @"C:\"; 
            sfx.ExistingFileBehavior = ExistingFileBehavior.OverwriteAlways; 
            Icon ico = new Icon(mappedImagePath + "ontario.ico"); 
            sfx.Icon = ico
 
            // We will zip directly in the response stream. The temporary compressed 
            // data will be written to the ZipArchive's TempFolder, thus the MemoryFolder  
            // we set in Application_Start. 
            ZipArchive destination = new ZipArchive(new StreamFile(_view.PageResponse.OutputStream)); 
            destination.BeginUpdate(); 
            getFilesToProcess2.Sort(); 
 
            ArrayList refineProcessList = RefineProcessList(getFilesToProcess2); 
            _view.Progress["SecondaryTotal"] = refineProcessList.Count.ToString(); 
 
            foreach (int file in refineProcessList) 
            { 
                _view.Progress["CurrentOperationText"] = file.ToString(); 
                AddFolderAndFiles(dmConnection.DmDocumentSecurityToken, dmConnection.DmLibraryName, file, destination, "", new ArrayList()); 
                _view.Progress["SecondaryValue"] = refineProcessList.IndexOf(file).ToString(); 
                string test2 = _view.StringClientScript; 
            } 
            _view.Progress["CurrentOperationText"] = "Completed"; 
            string test1 = _view.StringClientScript; //calls javascript hide() function 
 
            destination.SfxPrefix = sfx
            destination.DefaultCompressionMethod = Xceed.Compression.CompressionMethod.Deflated; 
            destination.EndUpdate(); 
 
            // And finally we zip in a single operation. If we had to zip more than 
            // one source, we could have used ZipArchive.BeginUpdate/EndUpdate. 
            ArrayList nameFilters = new ArrayList(); 
            _view.PageResponse.End(); 
        } 

Thanks,
David

1 Answer, 1 is accepted

Sort by
0
Accepted
Erjan Gavalji
Telerik team
answered on 29 Jul 2008, 12:08 PM
Hi David,

The progress area does not disappear, because the page does not get reloaded, which in turn happens, because of the Response.End call in the end of the method.

If your scenario need to have the Response.End call, you can handle the OnClientProgressUpdating event, where you can determine if the progress data is the last expected and use the hide() method to hide the progress area.

Let me know if I am missing something.

Regards,
Erjan Gavalji
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Upload (Obsolete)
Asked by
David S
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Share this question
or