This is a migrated thread and some comments may be shown as answers.

Is there a way to make Asyncupload not auto upload if only 1 file is selected?

1 Answer 125 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 04 Jun 2013, 07:39 PM
Hello,

We are trying to migrate over from the Radupload control to the RadAsyncupload control. We have a grid that has the radupload control within an edit template of a rad grid. With the old radupload you could select a fill, fill out some details on the file (title, description) click upload and it would upload, insert into the grid. 

We would like RadAsyncupload to behaving this way if only 1 file is selected. If multiple files are selected we can't ask for these details and simply begin the upload. They may go and edit the items in the grid later if they so choose.

We have a solution that toggles between modes but they need to refresh the page, this action simply disables all plugins and sets manual upload which makes the Asyncupload fall back to the old Iframe mode.

Is it possible to set these modes by setting values client side on the radasyncupload control within the onClientFilesSelected event handler?  I already tried setting the .manuaUpload property and that doesn't seem to work. 

Thanks.

1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 07 Jun 2013, 04:21 PM
Hi Richard,

Try to set ManualUpload to true and cancel uploading if only one file is selected:
Copy Code
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" OnClientFileUploading="OnClientFileUploading" ManualUpload="true"></telerik:RadAsyncUpload>
<input id="Button1" type="button" value="button" onclick="startUpload();"/>

Copy Code
<script type="text/javascript">
            function OnClientFileUploading(sender, args) {
                if (sender._selectedFilesCount == 1) {
                    args.set_cancel(true);
                    alert('Please select file');
                }
            }
 
            function startUpload() {
                var upload = $find('<%= RadAsyncUpload1.ClientID%>');
                upload.startUpload();
                 
            }
        </script>

Regards,
Hristo Valyavicharski
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
AsyncUpload
Asked by
Richard
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or