client side detect upload coount?

2 posts, 0 answers
  1. randall
    randall avatar
    40 posts
    Member since:
    Apr 2009

    Posted 15 Apr 2014 Link to this post

    Hi,
    i'm trying to detect the upload count on client side and determine if its 0.
    If so i want to enable a panel. I've searched on the forum but cannot find a good example of how to detect upload count.

    anyone have an example how to do this?

    thanks
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 Apr 2014 in reply to randall Link to this post

    Hi randall,


    You can't get the count of the uploaded file from client side. One suggestion is that you can use a global variable and increment it by one in the OnClientFileUploaded event and decrement by one in the OnClientFileUploadRemoved event. Please have a look into the sample code snippet which works fine at my end.

    ASPX:
    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" OnClientFileUploaded="OnClientFileUploaded" OnClientFileUploadRemoved="OnClientFileUploadRemoved" MultipleFileSelection="Automatic">
    </telerik:RadAsyncUpload>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Count" AutoPostBack="false"
        OnClientClicked="UploadedFileCount">
    </telerik:RadButton>

    JavaScript:
    <script type="text/javascript">
        var uploadedFile = 0;
        function OnClientFileUploaded(sender, args) {
            uploadedFile++;
        }
        function OnClientFileUploadRemoved(sender, args) {
            uploadedFile--;
        }
        function UploadedFileCount(sender, args) {
            alert("Uploaded File " + uploadedFile);
        }
    </script>

    Let me know if you have any concern.
    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top