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

FileUploaded event is not firing

3 Answers 381 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Om
Top achievements
Rank 1
Om asked on 07 Feb 2014, 10:48 AM
Hi,

    FileUploaded event is not firing in any browser. I have a page named CustomerCare.aspx which is assciated with master page. I have the RadTabStrip & RadMultipage control to bind the tab dynamically on CustomerCare Page and load the user control dynamicaaly onclick of tabs.

    In this case Fileuploaded event is not firing also the look of RadAsyncUpload control is not proper.

    Waiting for the reply. I need the response ASAP.


    Thanks & Regards,

    Om Prakash

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Feb 2014, 06:11 AM
Hi Om,

Please have a look into the sample code snippet which works fine at my end.

Content Page ASPX:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1">
        <Tabs>
            <telerik:RadTab Text="Tab1">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server">
    </telerik:RadMultiPage>
</asp:Content>

Content Page C#:
protected void Page_Init(object sender, EventArgs e)
{
    RadPageView PageView = new RadPageView();
    PageView.ID = "PageView1";
    Control mynewcontrol = new Control();
    mynewcontrol = LoadControl("UploadInTab.ascx");
    PageView.Controls.Add(mynewcontrol);
    RadMultiPage1.PageViews.Add(PageView);
}

User Control Page ASCX:
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" OnFileUploaded="RadAsyncUpload1_FileUploaded">
</telerik:RadAsyncUpload>
<telerik:RadButton ID="RadButton1" runat="server" Text="Upload">
</telerik:RadButton>

User Control Page C#:
protected void RadAsyncUpload1_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e)
{
    Response.Write("Fired");
}

Hope this will helps you.
Thanks,
Shinu.
0
Khin Myo
Top achievements
Rank 1
answered on 14 Jun 2016, 06:32 AM

Hi,

I am a beginner of the web development area. I used the RadAsyncUpload control in my project and FileUploaded event is not firing in any browser. Anyone can help me, please.

Please see my code below:

<telerik:RadAsyncUpload RenderMode="Lightweight" ID="rauFileUpload" runat="server" 
                                    OnFileUploaded="rauFileUpload_FileUploaded" PostbackTriggers="Button1"
                                    MaxFileSize="2097152" AllowedFileExtensions="jpg,png,gif,bmp" TargetFolder="~/UploadedFiles"
                                    AutoAddFileInputs="false" Localization-Select="Upload Image"  MaxFileInputsCount="1"/>

 

protected void rauFileUpload_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e)
        {
            var targetFolder = @"C:\temp";
            e.File.SaveAs(Path.Combine(targetFolder, e.File.GetName()));
        }

0
Ivan Danchev
Telerik team
answered on 15 Jun 2016, 01:41 PM
Hello Khin Myo,

As mentioned in the documentation the event fires after selecting a file and initiating a postback, for example by clicking an asp:Button. However, since you have set the AsyncUpload's PostBackTriggers property the file will be uploaded and the event will fire only if you initiate a postback with the control, the ID of which you are setting to the PostBackTriggers property ("Button1"). If the postback is initiated by a different control the event will not fire.
 
Regards,
Ivan Danchev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
AsyncUpload
Asked by
Om
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Khin Myo
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or