Repeated calls to Repeated calls to raduploadprogresshandler.ashx after Ajax call

Thread is closed for posting
10 posts, 0 answers
  1. Mike
    Mike avatar
    36 posts
    Member since:
    Sep 2012

    Posted 06 Feb 2012 Link to this post

    Here's the issue:

    When I have a RadUpload control on the page and then do any type of Ajax call before a submit, there is repeated calls to Raduploadprogresshandler.ashx until the browser is shut down. This issue was also documented here:

    http://www.telerik.com/community/forums/aspnet-ajax/upload/mulitple-requests-to-telerik-raduploadprogresshandler-ashx.aspx 

    but, I tried both of those fixes and neither worked completely. Adding:

    <add key="AllowCustomProgress" value="false"/> 

    to the web.config worked, but only if the RadUpload control did not have a file already selected.

    What is the correct way of avoiding this issue?

    Thanks!

    - Mike
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 09 Feb 2012 Link to this post

    Hi Mike,

    The workaround suggested in the forum thread you have mentioned  is indeed valid only when there is no file selected in the RadUpload. Please try to add the following code , right after the declaration of your RadScriptManager or ScriptManager:
    <script type="text/javascript">
     
                Telerik.Web.UI.RadProgressManager.prototype._clientSubmitHandler = function (eventArgs) {
                     
                    var cancelArgs = new Sys.CancelEventArgs();
     
                    this.raiseEvent('submitting', cancelArgs);
                    if (cancelArgs.get_cancel()) {
                        return $telerik.cancelRawEvent(eventArgs);
                    }
     
                    if (!this._allowCustomProgress) {
                        var hasFiles = false;
     
                        var inputs = $telerik.$("input[type='file']");
                        $telerik.$.each(inputs, function () {
                            if (this.value != "" && !Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {
                                hasFiles = true;
                                //exit the loop
                                return;
                            }
                        });
     
                        if (!hasFiles)
                            return;
                    }
                }
            </script>


    Kind regards,
    Dimitar Terziev
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mike
    Mike avatar
    36 posts
    Member since:
    Sep 2012

    Posted 10 Feb 2012 Link to this post

    Hi,

    I code snippet above does the trick, thanks! Is this workaround going to be fixed anytime soon? That is - should I remove this fix after the next release?

    Thanks,

    Mike Oliver
  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 14 Feb 2012 Link to this post

    Hi Mike,

    I'm glad that the overwrite provided is working for you. As for your question, yes this will be fixed in some of the upcoming internal builds, so my suggestion is to keep track of the release notes. This way when the issue is fixed you could remove the unnecessary code.

    Greetings,
    Dimitar Terziev
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. richard
    richard avatar
    48 posts
    Member since:
    Dec 2010

    Posted 17 Apr 2014 Link to this post

    I am having the same problem when using the progress bar on a page.
    I have a progress bar used while a page is loading alot of data from the database. So I tried the "fix" above and now the progress bar does not show at all....all of the unneeded calls from the ashx stopped but now no progress bar at all.

    This problem is many years old is there a real fix or?????

    What do i do?
  7. Mike
    Mike avatar
    36 posts
    Member since:
    Sep 2012

    Posted 17 Apr 2014 in reply to richard Link to this post

    I had to modify the above fix awhile ago as a new version of Telerik broke it. Here's our latest hack:

    // "fix" for repeated progress calls after Ajax
    if (typeof (Telerik) != "undefined" && typeof (Telerik.Web.UI.RadProgressManager) != "undefined")
    {
    Telerik.Web.UI.RadProgressManager.prototype._origClientSubmitHandler = Telerik.Web.UI.RadProgressManager.prototype._clientSubmitHandler;
    Telerik.Web.UI.RadProgressManager.prototype._clientSubmitHandler = function (eventArgs)
    {
    var async = (eventArgs != null); // hack - assumption that param is null when called via non-ajax postback, otherwise contains ajax element info
    if (async)
    return;

    this._origClientSubmitHandler(eventArgs);
    }
    }
  8. richard
    richard avatar
    48 posts
    Member since:
    Dec 2010

    Posted 17 Apr 2014 in reply to Mike Link to this post

    Mike,

    Thanks for the code but now my progress bar doesn't show at all.
  9. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 22 Apr 2014 Link to this post

    Hello Richard,

    Could you please confirm that using the workaround posted by Dimitar Terziev did not work for your scenario and your progress bar does not show at all?


    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  10. richard
    richard avatar
    48 posts
    Member since:
    Dec 2010

    Posted 22 Apr 2014 in reply to Boyan Dimitrov Link to this post

    That is correct ** it did not work **
  11. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 25 Apr 2014 Link to this post

    Hello Richard,

    I am afraid that I am not able to replicate the described issue. We would need a sample project that replicates this problem so we can investigate this issue at our end and provide you a proper solution for your case. Since this is a forum thread you will not be able to attach any files so I would ask you to open a support thread and attach a sample project or simply a page that replicates the described problem. Here you may find some instruction on how to isolate a problem in a runnable sample project.


    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017