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
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
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
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
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
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
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
Thanks,
Adam
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
Thanks,
Adam
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>
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.
Thank you for summarizing our conversation in the ticket regarding this issue and sharing it with the community.
Greetings,
Dobromir
the Telerik team