Fire event after all uploads

2 posts, 0 answers
  1. prasad g
    prasad g avatar
    1 posts
    Member since:
    Sep 2009

    Posted 15 Sep 2015 Link to this post

    Dear All,

    I have 3 upload controls and a single radbutton. What I want to achieve is; when files are selected, upload doesnot start yet. When the button is clicked; All uploads start; 

    After all 3 uploads are finished; the radbuttons click event is fired.

    Any ideas?

     Thanks a lot in advance,

     

    <telerik:RadAsyncUpload ID="RadAsyncUpload1"  MultipleFileSelection="Disabled" runat="server"></telerik:RadAsyncUpload>
        <telerik:RadAsyncUpload ID="RadAsyncUpload2"   MultipleFileSelection="Disabled" runat="server"></telerik:RadAsyncUpload>
        <telerik:RadAsyncUpload ID="RadAsyncUpload3"  MultipleFileSelection="Disabled" runat="server"></telerik:RadAsyncUpload>
        <telerik:RadButton ID="RadButton1" OnClick="RadButton1_Click" runat="server" Text="Upload Files"></telerik:RadButton>​

     

     

  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 18 Sep 2015 Link to this post

    Hi,

    You can try this:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <Scripts>
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
                </Scripts>
            </telerik:RadScriptManager>
            <script type="text/javascript">
                var file1 = false;
                var file2 = false;
                var file3 = false;
                var upload1;
                var upload2;
                var upload3;
     
                function pageLoad() {
                    upload1 = $find("RadAsyncUpload1");
                    upload2 = $find("RadAsyncUpload2");
                    upload3 = $find("RadAsyncUpload3");
                }
     
                function fileSelected(sender, args) {
                    var control = sender.get_id();
                    switch (control) {
     
                        case "RadAsyncUpload1":
                            file1 = true;
                            break;
                        case "RadAsyncUpload2":
                            file2 = true;
                            break;
                        case "RadAsyncUpload3":
                            file3 = true;
                            break;
                        default:
     
                    }
                    
                    if (file1 && file2 && file3) {
                        $find("RadButton1").set_enabled(true);
                    }
                }
            </script>
            <telerik:RadAsyncUpload ID="RadAsyncUpload1" ManualUpload="true" OnClientFileSelected="fileSelected" MultipleFileSelection="Disabled" runat="server"></telerik:RadAsyncUpload>
            <telerik:RadAsyncUpload ID="RadAsyncUpload2" ManualUpload="true" OnClientFileSelected="fileSelected" MultipleFileSelection="Disabled" runat="server"></telerik:RadAsyncUpload>
            <telerik:RadAsyncUpload ID="RadAsyncUpload3" ManualUpload="true" OnClientFileSelected="fileSelected" MultipleFileSelection="Disabled" runat="server"></telerik:RadAsyncUpload>
     
            <telerik:RadButton ID="RadButton1" OnClick="RadButton1_Click" runat="server" Enabled="false" Text="Upload Files"></telerik:RadButton>
        </form>
    </body>
    </html>


    Regards,
    Hristo Valyavicharski
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top