RadAsyncUpload in repeater issue

Thread is closed for posting
2 posts, 0 answers
  1. Dar
    Dar avatar
    1 posts
    Member since:
    Apr 2013

    Posted 04 Apr 2013 Link to this post

    I have a RadAsyncUpload in repeater. The problem is that when the upload button is clicked (which is in the same row of the repeater), there is no file uploaded after the postback. my code is:

    protected void rptAttendeeHeadShot_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
    ...
    RadAsyncUpload fileUploadHeadShot = (RadAsyncUpload)e.Item.FindControl("fileUploadHeadShot");
    fileUploadHeadShot.ID = "fileUploadHeadShot_" + (e.Item.ItemIndex + 1);
    fileUploadHeadShot.ClientIDMode = ClientIDMode.Static;
    ...
    }

    protected void rptAttendeeHeadShot_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
    ...
    RadAsyncUpload fileUploadHeadShot = (RadAsyncUpload)e.Item.FindControl("fileUploadHeadShot");
    string[] validExtensions = { ".jpg", ".jpeg", ".png", ".gif", ".bmp" };
                    if (fileUploadHeadShot.UploadedFiles.Count > 0)
                    {
    }
    ...
    }

    and in the repeater:
    <telerik:RadAsyncUpload ID="fileUploadHeadShot" runat="server" MultipleFileSelection="Disabled"
                                                MaxFileInputsCount="1" HttpHandlerUrl="~/CustomHandler.ashx" MaxFileSize="52428801"
                                                OnClientFilesUploaded="headShotOnchange" OnClientFileUploadRemoved="headShotOnRemove"
                                                >
                                            </telerik:RadAsyncUpload>
  2. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 09 Apr 2013 Link to this post

    Hello Dar,

    From the provided code it seems that you are recreating the repeater on every postback. That is why the state of the RadAsyncUpload control is lost. Before you bind the control you need to find the row and RadAsyncUpload control and get the uploaded files.

    Kind regards,
    Peter Filipov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top