SlickUpload
Welcome Guest Search | Active Topics | Log In | Register

Infinite Page Reload when AutoCompleteAfterLastFile="true" Options
klbytec
#1 Posted : Monday, September 19, 2011 4:00:38 AM
Rank: Member

Groups: Registered

Joined: 7/6/2009
Posts: 17
Location: nyc

I downloaded the sample and ran \SlickUpload-6.0.7\Samples\AspNetAjaxCs\AspNetAjaxCs-VS2010\Slick\Default.aspx.  As soon as I changed <kw:UploadConnector Id="slickUpload" AutoCompleteAfterLastFile="false"..... to AutoCompleteAfterLastFile="true", when I view the page, the page just keeps on reloading and reloading.

I am attempting to fire slickUpload_UploadComplete automatically after all files finished uploading, but it started reloading itself repeatedly before I could do anything or select any file.

Am I using it incorrectly?

 

Also instead of the above, if I choose to have user click an Upload button after all files are selected, isntead of automatically upload when each file is selected, how do I do that?

Thanks!

Axosoft
#2 Posted : Monday, September 19, 2011 8:40:39 AM
Rank: Administration


Groups: Administrators

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

Look at the javascript at the top of that file. See this block, at the end of the script tag?

        function init()
        {
        kw(function ()
        {
            if (kw.support.dragDrop)
                document.getElementById("dropInstructions").style.display = "block";

            kw("<%=slickUpload.ClientID %>").start();
        });        
        }

This is the init function that will be called as soon as SlickUpload is initialized. If you're familar with jQuery, the kw function is like $. In other words, if you pass it a function, it will be called on document ready (or immediately, if the document is already ready). If you pass it a string, it will return the component.

For the Slick sample, .start() is called on init, to start the uploading process (rather than the user needing to hit a start button manually). This is why adding AutoCompleteAfterLastFile="true" is causing the reload loop -- the upload process starts on page init, determines that it has no remaining files to upload, and posts back.

It sounds like you want to have the opposite functionality -- users pick files, click submit, then the upload starts. This is how all of the other samples are done. You'll basically want to do three things:

 - Set AutoCompleteAfterLastFile="true" and AutoUploadOnSubmit="true" on the UploadConnector control. This will set up the control to complete after the last file, and start uploading when anything on the page tries to post back the page.
 - Remove the .start() line so the control doesn't start uploading too early
 - Add a button to start the upload. You can use any normal ASP.NET runat=server Button/LinkButton that causes a postback, or you can copy that .start() call to your click handler rather than having it get called on init.

Let me know if you have any other questions.

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.