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

2 posts, 0 answers
  1. Richard
    Richard avatar
    4 posts
    Member since:
    Mar 2011

    Posted 04 Jun 2013 Link to this post

    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.

  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 07 Jun 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top