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

RadUpload in UserControl (.ascx)

1 Answer 59 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Karl Rohrbach
Top achievements
Rank 1
Karl Rohrbach asked on 16 Nov 2011, 06:33 PM
Does RadUpload not work in a user control (.ascx)?   CaseFile.UploadedFiles.Count is always 0.  Any help would be greatly appreciated.  KR

Code Behind
protected void AttachmentCase_AddClick(object sender, EventArgs e)
{
    CaseAgentActions.CaseOpenFile attachment = new CaseAgentActions.CaseOpenFile();
 
    // Attach the file referenced to upload.
    if (CaseFile.UploadedFiles.Count > 0)
    {
        foreach (UploadedFile item in CaseFile.UploadedFiles)
        {
            attachment.Filename = item.FileName;
            byte[] attachmentBytes = new byte[item.InputStream.Length];
            item.InputStream.Read(attachmentBytes, 0, attachmentBytes.Length);
            attachment.FileData = attachmentBytes;
            page.oCaseOpen.Files.Add(attachment);
        }
    }
 
    AttachmentsGrid.Rebind();
}

.ASCX

<telerik:RadUpload ID="CaseFile" runat="server" InitialFileInputsCount="3" MaxFileInputsCount="10" Width="400px"></telerik:RadUpload>
<asp:Button ID="AddFileButton" runat="server" Text="Add File" OnClick="AttachmentCase_AddClick"
Width="120px" CssClass="Case_Search_Button" Font-Bold="true" Font-Size="10px"
Height="20px" CausesValidation="false" />

1 Answer, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 18 Nov 2011, 02:04 PM
Hello Karl Rohrbach,

I couldn't reproduce your problem. I've attached a sample project with your user control and it works fine. I also included a screenshot from the debugging of the program, showing the file count.

However, the control won't work if you place it insinde an UpdatePanel.

All the best,
Bozhidar
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
Karl Rohrbach
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Share this question
or