Set default values for Upload in base class

Thread is closed for posting
1 posts, 0 answers
  1. Thiago
    Thiago avatar
    9 posts
    Member since:
    Dec 2011

    Posted 11 Apr 2013 Link to this post

    I have a few web forms that proccess excel files, so in order to make this easier, I have a base class like this:

    public abstract class ExcelImporter : Page {
        public abstract RadAsyncUpload FileUpload { get; }
    
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (FileUpload != null)
            {
                DefineRadAyncUpload();
            }
        }
    
        private void DefinirRadAyncUpload()
        {
            FileUpload.Skin = Skin;
            FileUpload.Culture = new System.Globalization.CultureInfo("pt-BR");
            FileUpload.TemporaryFolder = "~/temp";
            FileUpload.OnClientFileUploaded = "PostBackAsyncUploadComplete";
            FileUpload.AllowedFileExtensions = new[] { "xls", "xlsx" };
            FileUpload.MaxFileInputsCount = 1;
            FileUpload.FileUploaded += FileUploadOnFileUploaded;
        }
    
        protected abstract void FileUploadOnFileUploaded(object sender, FileUploadedEventArgs fileUploadedEventArgs);
    }

    Everything i'm setting in the Define method is working, except the extension filter. What am I doing wrong? is there another moment that I shoud set this property?

Back to Top