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

Upload is null

1 Answer 45 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Majid Mahmoodi
Top achievements
Rank 1
Majid Mahmoodi asked on 17 Apr 2012, 10:09 AM
Dear Support
My code is :
public class FileSelector:Telerik.Web.UI.RadFileExplorer
    {
        public string Path { get; set; }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if(string.IsNullOrEmpty(Path))
                Path = "~/Files/editor/";
            Configuration.DeletePaths = Configuration.UploadPaths = Configuration.ViewPaths = new string[] { Path+"images/" };
            Upload.AllowedFileExtensions = Configuration.SearchPatterns= new string[] { "*.jpg", "*.jpeg", "*.gif", "*.png" };;
            Upload.InitialFileInputsCount = 1;
            Upload.ControlObjectsVisibility = ControlObjectsVisibility.None;
        }
    }
-----------
Upload is null.
How can I access FileExplorer's Upload?
THanks.

1 Answer, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 18 Apr 2012, 09:24 AM
Hi Majid,

The provided code looks OK with one small exception. The ViewPaths / UploadPaths / DeletePaths properties are initialized in the controls OnLoad event, thus you need to apply the customizations before base method, e.g.:
protected override void OnLoad(EventArgs e)
{
     
    if (string.IsNullOrEmpty(Path))
        Path = "~/Files/editor/";
    Configuration.DeletePaths = Configuration.UploadPaths = Configuration.ViewPaths = new string[] { Path + "images/" };
    Upload.AllowedFileExtensions = Configuration.SearchPatterns = new string[] { "*.jpg", "*.jpeg", "*.gif", "*.png" }; ;
    Upload.InitialFileInputsCount = 1;
    Upload.ControlObjectsVisibility = ControlObjectsVisibility.None;
 
    base.OnLoad(e);
}

I am not quite sure what may be causing the experienced problem. I tried the code snippet in a sample page and it was working as expected. For your convenience I have attached my test page, could you please modify it to a point where the problem occurs and send it back?

Kind regards,
Dobromir
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
FileExplorer
Asked by
Majid Mahmoodi
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or