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

RadAsyncUpload in repeater issue

1 Answer 131 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Dar
Top achievements
Rank 1
Dar asked on 04 Apr 2013, 05:07 PM
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>

1 Answer, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 09 Apr 2013, 07:52 AM
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.
Tags
Upload (Obsolete)
Asked by
Dar
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
Share this question
or