Upload selected files without button click.

5 posts, 1 answers
  1. Dona
    Dona avatar
    23 posts
    Member since:
    Apr 2013

    Posted 07 Aug 2013 Link to this post

    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
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Aug 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dona
    Dona avatar
    23 posts
    Member since:
    Apr 2013

    Posted 08 Aug 2013 Link to this post

    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.
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Aug 2013 Link to this post

    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.

  6. Dona
    Dona avatar
    23 posts
    Member since:
    Apr 2013

    Posted 13 Aug 2013 Link to this post

    Thanks for your neat explanation.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017