RadUpload in UserControl (.ascx)

Thread is closed for posting
2 posts, 0 answers
  1. Karl Rohrbach
    Karl Rohrbach avatar
    20 posts
    Member since:
    Oct 2009

    Posted 16 Nov 2011 Link to this post

    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;


    <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" />

  2. Bozhidar
    Bozhidar avatar
    1189 posts

    Posted 18 Nov 2011 Link to this post

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