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

RadFileExplorer Upload Progress Context

14 Answers 194 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 20 Mar 2012, 11:28 PM
Has anyone gotten the Upload Progress to work in RadFileExplorer?  There is a code library here: http://www.telerik.com/community/code-library/aspnet-ajax/file-explorer/add-a-radprogressarea-inside-the-upload-dialog.aspx that goes into it and it works.  I have that implemented on my site however if you are uploading say a 20MB document the upload progress bar only shows up at the end right before the file is completely uploaded.  So it's like the upload is nearly complete then the upload progress bar flashes for a second then the upload is done.  Here is my code:

ASCX:

function

 

 

OnClientLoad(oFExplorer, args) {

windowManager = oFExplorer.get_windowManager();

windowManager.add_show(uploadWindowShown);

}


function

 

uploadWindowShown(oWindow, args) {

 

if (oWindow.get_title() == "Upload") {// The upload window

 

//oWindow.moveTo(200, 100);

 

// Find the upload button in the Upload dialog

 

var uploadBtn = $get("<%= RadFileExplorer1.ClientID %>_btnUpload");

uploadBtn.onclick =

 

function (e) {

 

this.style.display = "none";

};

 

var progressArea = $find("<%= RadProgressArea1.ClientID %>");

 

// Use the button to find the parent node

uploadBtn.parentNode.insertBefore(progressArea.get_element(), uploadBtn);

}

}


<

 

 

telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" EnableCopy="true" OnExplorerPopulated="RadFileExplorer1_ExplorerPopulated"

 

OnClientFileOpen="OnClientFileOpen"

 

OnClientFolderLoaded="OnClientFolderLoaded"

 

OnClientLoad="OnClientLoad"

 

OnClientMove="OnClientMove"

 

OnClientFolderChange="OnClientFolderChange"

 

OnClientCopy="OnClientCopy"

 

OnClientCreateNewFolder="OnClientCreateNewFolder"

 

OnClientDelete="OnClientDelete"

 

Width="100%" KeyboardShortcuts-Back="BACK" KeyboardShortcuts-Delete="DEL"

 

KeyboardShortcuts-Forward="RIGHT" KeyboardShortcuts-UploadFile="F12" KeyboardShortcuts-Refresh="F5" KeyboardShortcuts-PopupWindowClose="ESC"

 

KeyboardShortcuts-NewFolder="F3" Configuration-MaxUploadFileSize="1572864000" DisplayUpFolderItem="false" OnItemCommand="RadFileExplorer1_ItemCommand"></telerik:RadFileExplorer>

CODE BEHIND:

 

protected

 

 

 

 

 

 

 

 

void RadFileExplorer1_ItemCommand(object sender, RadFileExplorerEventArgs e)

{

 

 

 

 

 

if (e.Command.Equals("UploadFile"))

{

 

 

 

 

 

RadProgressContext context = RadProgressContext.Current;

context.SecondaryTotal = Request.Files.Count;

 

 

 

 

 

for (int i = 1; i < Request.Files.Count; i++)

{

 

 

 

 

 

// A very time consumming task

context.SecondaryValue = i.ToString();

context.SecondaryPercent = i.ToString();

context.CurrentOperationText =

 

 

 

 

 

"Doing step " + i.ToString();

 

 

 

 

 

if (!Response.IsClientConnected)

{

 

 

 

 

 

//Cancel button was clicked or the browser was closed, so stop processing

 

 

 

 

 

break;

}

}

}

}

Thanks,
Adam

14 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 21 Mar 2012, 10:32 AM
Hi Adam,

The experienced behavior is due to the implementation of the ItemCommand handler. The for loop in the code represents the steps that will be displayed / performed by RadProgressArea. In the provided code snipped the number of steps is the number of uploaded files

for (int i = 1; i < Request.Files.Count; i++)

So, when a single file is uploaded RadProgressArea will visualize only one step.


Regards,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Adam
Top achievements
Rank 1
answered on 21 Mar 2012, 01:03 PM
I changed that number back to 100 and it does the same thing.  I tested with a 3.5MB file.  It uploads the file first then the Progress bar shows up and goes through it's steps.  The progress bar doesn't show up until the file is already uploaded.  Any thoughts?
0
Dobromir
Telerik team
answered on 22 Mar 2012, 03:13 PM
Hi Adam,

I am not quite sure why this code is not working for you. I tried it locally and it is working as expected. This video demonstrates my test, could you please see if I am missing something?

To run the provided code snippet I had to remove several event handlers, for your convenience I have attached my test site, could you please modify it to a point where the problem occurs and send it back?

Greetings,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Adam
Top achievements
Rank 1
answered on 23 Mar 2012, 02:59 PM
Dobromir,

Thanks for your help.  I found the issue.  I have captured a video and posted it here: http://screencast.com/t/NE6Nk8fRC.  I noticed if you click the Upload button from the Toolbar it works fine.  It you choose Upload from the context menu it fails.  Please see my video.

Thanks,
Adam
0
Dobromir
Telerik team
answered on 28 Mar 2012, 11:26 AM
Hi Adam,

Calling upload dialog from the context menu or from the toolbar is the same, nevertheless, I tried both context menus (the grid's and the treeview's) and still was unable to replicate the problem.

In the provided video I noticed that the file you are uploading is 9MB and I believe the observed behavior is due to the fact that the upload process pass too fast, for my tests I am using 100MB file. Could you please try to add small delay in the ItemCommand's handler and test again?
protected void RadFileExplorer1_ItemCommand(object sender, RadFileExplorerEventArgs e)
{
    if (e.Command.Equals("UploadFile"))
    {
        RadProgressContext context = RadProgressContext.Current;
        context.SecondaryTotal = Request.Files.Count;
        for (int i = 1; i < 100; i++)
        {
            // A very time consumming task
            context.SecondaryValue = i.ToString();
            context.SecondaryPercent = i.ToString();
            context.CurrentOperationText = "Doing step " + i.ToString();
            if (!Response.IsClientConnected)
            {
                //Cancel button was clicked or the browser was closed, so stop processing
                break;
            }
            System.Threading.Thread.Sleep(100);
        }
    }
}


Greetings,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Adam
Top achievements
Rank 1
answered on 28 Mar 2012, 08:18 PM
I have a new video linked here: http://screencast.com/t/g7UVQHsK

I tried what you suggested but cannot get it to work.  In this video I show all of my ascx code including the script within the RadScriptBlock just to see if you see where there might be an issue.

Thank you,
Adam
0
Dobromir
Telerik team
answered on 29 Mar 2012, 05:26 PM
Hi Adam,

Thank you for the provided video. This problem seems very odd. Are you able to reproduce it using the sample page that I have attached to one of my previous replies? If so, could you please send us the Fiddler’s log capturing upload process and a live URL so we can investigate the problem further? You can find information of how to work with this useful tool at: http://www.ehow.com/how_5598400_use-fiddler-debugger.html and http://www.west-wind.com/weblog/posts/596348.aspx.


Greetings,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Adam
Top achievements
Rank 1
answered on 02 Apr 2012, 09:07 PM
I purchased the asp.net controls today.  I just created a support ticket for this.  I will upload my entire project to you over there.  Hopefully we can figure it out.  I will post back here when we find a solution just in case someone else runs into this issue.
Thanks,
Adam
0
Michael Constantine
Top achievements
Rank 1
answered on 04 Apr 2012, 07:59 PM
Hi!

Any luck with this?  I seem to be experiencing the same results as you.  (Progress show up after file has been uploaded)   When i downloaded the sample page from the last post, it seemed to work ok.  Only differences are:  I am using VB, and my script manager is on a masterpage where the file manager is running in contentPlaceHolder.  Other than that my code is identical.

Please let me know if they have figured out what might be wrong?

Thanks,
Michael
0
Adam
Top achievements
Rank 1
answered on 04 Apr 2012, 08:16 PM
I am working with Telerik on a support ticket right now to resolve this.  They are being extremely helpful.  I will post the results as we find them.

Thanks,
Adam
0
Michael Constantine
Top achievements
Rank 1
answered on 04 Apr 2012, 11:03 PM
Thanks Adam.
0
Adam
Top achievements
Rank 1
answered on 10 Apr 2012, 06:20 PM
Ok as promised here are the results.  Telerik support was unbelievable on this.  They worked with me every day for weeks trying to get this resolved.  They went above and beyond.  Anyone looking for the best product with the best support this is it.

RESULTS:
Ultimately the issue became a web service I had referenced.  I removed the reference to this web service from my RadSriptManager and recompiled the site and the upload progress control worked.  However I really needed this web service.  So I added the service reference back, recompiled the site and boom it works!  Unfortunately I cannot explain how and maybe Telerik can help there but it works and that is what I did to get it to work.  Secondary things that Telerik had me do are below that also helped with other issues with the upload progress bar.

SECONDARY RESULTS:
Add this to the web.config file to prevent the upload progress control from showing if you are doing large file downloads:
<appSettings>
    <add key="AllowCustomProgress" value="false" />
</appSettings>

Make sure this is in your web.config <system.webserver> section:
<modules>
<remove name="RadUploadModule" />
<add name="RadUploadModule" preCondition="integratedMode" type="Telerik.Web.UI.RadUploadHttpModule" />
</modules>
0
Adam
Top achievements
Rank 1
answered on 10 Apr 2012, 07:19 PM
FYI:

I can now confirm that removing the webservice reference, recompiling and then readding the webservice and recompiling absolutely fixes this.  I just upgraded my telerik DLL's from trial to DEV and it broke the upload progress area again and then I did the above and it works again!  Weird, but it works.
0
Dobromir
Telerik team
answered on 11 Apr 2012, 08:22 AM
Hi Adam,

Thank you for summarizing our conversation in the ticket regarding this issue and sharing it with the community.

Greetings,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
FileExplorer
Asked by
Adam
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Adam
Top achievements
Rank 1
Michael Constantine
Top achievements
Rank 1
Share this question
or