|
|
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
|
|
|
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.
|
|
|
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
|
|
|
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.
|
|
|
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
|
|
|
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 ?
|
|
|
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
|
|
|
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
|
|
|
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 ?
|
|
|
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
|
|
|
|
Guest |