FileUploaded event is not firing

4 posts, 0 answers
  1. Om
    Om avatar
    3 posts
    Member since:
    Feb 2014

    Posted 07 Feb 2014 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Feb 2014 in reply to Om Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Khin Myo
    Khin Myo avatar
    3 posts
    Member since:
    Jun 2016

    Posted 14 Jun Link to this post

    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()));
            }

  5. Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 15 Jun Link to this post

    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.
Back to Top