Upload is null

2 posts, 0 answers
  1. Majid Mahmoodi
    Majid Mahmoodi avatar
    4 posts
    Member since:
    Feb 2007

    Posted 17 Apr 2012 Link to this post

    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.
  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 18 Apr 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top