Reputation: 79
I am using the RadAsyncUpload. When I have uploaded a file I am expecting the OnFileUploaded
event to occur, but it is firing when I am clicking the submit button. Now two events - one for upload and the other for the submit button - are firing, one after the other.
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" EnableInlineProgress="true" UploadedFilesRendering="BelowFileInput"
HideFileInput="true" ClientIDMode="AutoID" MultipleFileSelection="Disabled"
Localization-Select="Choose File" Width="100%" MaxFileInputsCount="1" OnFileUploaded="rauploadCSVFile_OnFileUploaded">
</telerik:RadAsyncUpload>
<telerik:RadButton ID="rbtnSubmit" runat="server" AutoPostBack="true" CausesValidation="true" OnClick="rbtnSubmit_OnClick">
</telerik:RadButton>
How can I make RadAsyncUpload
fire the event when I have uploaded a file?
Upvotes: 2
Views: 4504
Reputation: 1092
OnFileUploaded will be executed on PostBack. That's why it doesn't react when you choose a file, but reacts on the Submit button being clicked.
I encountered a similar problem recently, here's how I solved it:
First of all, if you want RadAsyncUpload
to react to every file you choose to upload, you need to add the OnClientFilesUploaded
to telerik:RadAsyncUpload
, where you point to a JavaScript function. For example...
<telerik:RadAsyncUpload ID="RadAsyncUpload1" ... OnClientFileUploaded="OnRadAsyncUpload1ClientAction"> ...
</telerik:RadAsyncUpload>
And ofcourse, add your function to your scripts:
function OnRadAsyncUpload1ClientAction(source, args)
{
__doPostBack('RadAsyncUpload1', args);
}
It worked for me. I hope it'll work for you.
Upvotes: 4