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

Upload selected files without button click.

4 Answers 91 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Dona
Top achievements
Rank 1
Dona asked on 07 Aug 2013, 08:33 AM
Hi

I read that asyncupload requires  a postback to upload files such as a button click. But I want to upload all my selected files to the server once everything is selected without the user clicking a button. Any suggestion?

Thanks
Dona

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 07 Aug 2013, 09:38 AM
Hi Dona,

One suggestion is after the client file uploading completes, you can programmatically invoke a button click instead of manually clicking a button to create postback to upload files to the server. Please have a look at the following code I tried which works fine at my end.

JavaScript:
<script type="text/javascript">
    function OnClientFilesUploaded(sender, args) {
        var $ = $telerik.$;
        $('#RadButtonUpload').click();
    }
</script>

Thanks,
Shinu.
0
Dona
Top achievements
Rank 1
answered on 08 Aug 2013, 06:21 PM
Hi Shinu,

I have been googling what is $telerik.$ but I didnt get it. Is this something specific to telerik rather than jQuery? What is the difference between using "$" and "$telerik.$"?

Thanks,
Dona.
0
Shinu
Top achievements
Rank 2
answered on 09 Aug 2013, 03:37 AM
Hi Dona,

The $find in jQuery provides a shortcut to the Sys.Application.findComponent method which returns the corresponding component. From the Q3 2008 version of RadControls for ASP.NET AJAX the Telerik.Web.UI assembly includes the jQuery javascript library. Here the jQuery object is available as $telerik.$ instead of the default $ or jQuery aliases. This is so to avoid compatibility issues with applications which already use (other versions of) jQuery. For more info you can check the documentation of the noConflict method.

Fortunately there are easy workarounds to enable back the $ alias such as using a global variable in your script.

JavaScript:

<script type="text/javascript">
    window.$ = $telerik.$;
</script>

Thanks,
Shinu.

0
Dona
Top achievements
Rank 1
answered on 13 Aug 2013, 06:00 PM
Thanks for your neat explanation.
Tags
AsyncUpload
Asked by
Dona
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Dona
Top achievements
Rank 1
Share this question
or