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

PostBack without Upload Options
anthony.selby
#1 Posted : Monday, November 28, 2011 12:45:02 AM
Rank: Newbie

Groups: Registered

Joined: 11/28/2011
Posts: 9

I have a page where I want to select some information about a job and set somethings up about it before saving it. One of those things is uploaded documents but some of the other options create postback events.

 

Can I make the slickupload control only upload the file(s) when a certain button is clicked not just any postback ???

 

Thanks

 

I forgot to mention that I'm using asp.net webforms with vb ... thanks again

Axosoft
#2 Posted : Monday, November 28, 2011 10:29:20 AM
Rank: Administration


Groups: Administrators

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

Sure.

The easiest way to do this is:

  • Set the AutoUploadOnSubmit="false" attribute on the SlickUpload control
  • Create a startUpload function like this (where SlickUpload1 is the ID of the SlickUpload control on your page):
function startUpload()
{
    kw("<%=SlickUpload1.ClientID").start();
}
  • Call the startUpload function in the OnClientClick of your button, like this:
OnClientClick="startUpload();return false;";

Let me know if this works for you.

anthony.selby
#3 Posted : Monday, November 28, 2011 1:52:47 PM
Rank: Newbie

Groups: Registered

Joined: 11/28/2011
Posts: 9

Chris,

 

   Thanks for the quick reply ... that kind of worked ... It doesn't upload on every postback which is good but it clears the file list if it isn't uploading ??

  The javascript part of it worked great

Any ideas would be great thanks again

 

Anthony

Axosoft
#4 Posted : Monday, November 28, 2011 1:59:20 PM
Rank: Administration


Groups: Administrators

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

Are you using AJAX of some sort for the other postbacks? If not, the postback clears the files. This is unchangable browser behavior, unfortunately -- when you do a normal postback, the browser sends up all the data on the form and loads a new page. If the files aren't uploaded at that point, they're lost because there is no way to reselct them for upload.

This is why SlickUpload automatically uploads on every postback by default.

If you can use AJAX for the other postbacks, either custom stuff, ASP.NET AJAX UpdatePanel, or whatever, and update only that part of the page instead of doing a full postback, then the SlickUpload control won't be reset so the files will still be selected and available for upload.

anthony.selby
#5 Posted : Monday, November 28, 2011 2:02:09 PM
Rank: Newbie

Groups: Registered

Joined: 11/28/2011
Posts: 9
I have the slickupload control and a check box (that does a auto postback) in the same update panel when I check the checkbox thats when it refreshes the list

thanks
anthony.selby
#6 Posted : Monday, November 28, 2011 2:14:50 PM
Rank: Newbie

Groups: Registered

Joined: 11/28/2011
Posts: 9
Even if I put them in there own updatepanels it still clears all the files in the upload list ?

I don't know exactly what I'm doing so i might easily be doing something dumb but shouldn't that (putting each set of controls in there own updatepanel) only update the parts that need updated ?
Axosoft
#7 Posted : Monday, November 28, 2011 2:20:32 PM
Rank: Administration


Groups: Administrators

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

Yes, it should work that way. Do the Ajax sample projects work for you? It should show each part updating individually.

Can you send me your page so I can take a look? chrish@krystalware.com

anthony.selby
#8 Posted : Monday, November 28, 2011 2:21:38 PM
Rank: Newbie

Groups: Registered

Joined: 11/28/2011
Posts: 9
Thanks Chris ... I found it ... left the updatepanel set to all instead of conditional

Thanks again
anthony.selby
#9 Posted : Monday, November 28, 2011 9:51:12 PM
Rank: Newbie

Groups: Registered

Joined: 11/28/2011
Posts: 9
So I went back to using the javascript to start the upload and when I use it the uploadcomplete event never fires ?

if I turn the auto upload back on and remove the java script from the button the uploadcomplete fires perfectly

is there a way to get the javascript to start the upload and still get the uploadcomplete event on the server ?
anthony.selby
#10 Posted : Monday, November 28, 2011 9:53:42 PM
Rank: Newbie

Groups: Registered

Joined: 11/28/2011
Posts: 9
ok ... I have to turn off the autouploadonpost back then the upload_complete fires ... thanks again
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.