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

Fire event after all uploads

1 Answer 28 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
prasad g
Top achievements
Rank 1
prasad g asked on 15 Sep 2015, 03:10 PM

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>‚Äč

 

 

1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 18 Sep 2015, 07:16 AM
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
Tags
AsyncUpload
Asked by
prasad g
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or