Help Needed in Placing Uploader in a Update Panel

  •  01-05-2009, 4:21 PM

    Help Needed in Placing Uploader in a Update Panel

    hi,
     
    i came across your uploader and find it very useful component.
     
    basically i have to implement the uploader  along with other controls like textbox, drop down lists in aspx form.
     
    i followed simple-upload-Validation example and implemented the same using code behind.
     
    i placed the uploader in update panel while keeping other controls in the form(textbox,cascading drop down lists) outside update panel.
     
    structure of page is as:
     
    abc.aspx
     
    name                                              : required field validator
    country drop down list 1 (dependent) : 
    state drop down list 2 (dependent)     :
    summary                                         : required field validator
     
    SELECT A VIDEO TO UPLOAD           : ajax uploader
    (Uploader placed in update panel)
     
    link button (for Submit)                    :
     
    abc.aspx.cs page
     
    using CuteWebUI;
     

     

        protected void InsertMsg(string msg)
        {
            ListBoxEvents.Items.Insert(0, msg);
            ListBoxEvents.SelectedIndex = 0;
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            SampleUtil.SetPageCache();
          
            Uploader1.FileUploaded += new UploaderEventHandler(Uploader_FileUploaded);
          
        }
     
       protected void Uploader_FileUploaded(object sender, UploaderEventArgs args)
        {
            string folder = Server.MapPath("~\\UploaderTemp");
            string videoExt = Path.GetExtension(args.FileName);
            string fileExt = videoExt.ToLower();

            string savepath = System.IO.Path.Combine(folder, "id" + fileExt);
            args.MoveTo(savepath);
            InsertMsg("File uploaded! " + args.FileName + ", " + args.FileSize + " bytes.");
        }
     
    my questions here are:
     
    1) how can a full postback be achieved at time of video selection as other form controls are having required validation which prevents the full postback and this results in non postback events. there is no file movement to destination folder as a result and no result display in server trace window.
     
    but when i make selection in the cascading drop down list again, a postback is generated resulting in displaying the messsage in server trace window.
     
    how can automatic postback be achieved  using update panel.
     
    2) how can required validation on other form controls contained on the page  be disabled while uploading the file and how can these validation again enabled after the file is uploaded.
     
    also can the form elements be disabled at the time of uploading?
    eg: where should i place statement like (submitbtn.enabled = false;) which keeps the controls on form disable while the file is in uploading process.
     
    3) i also go through post (http://cutesoft.net/forums/post/44763.aspx)in the forum.
     
     how can we disable form validation on controls(contained in page) with the help of  functions like:
     
    //fired when upload is started
    function CuteWebUI_AjaxUploader_OnStart()
    {
     var hidden=this;
     hidden.internalobject.insertBtn.style.display='none'
    }
     
    4) how can we use uploader functionality inside a link button

    eg:  protected void LinkButton1_Click(object sender, EventArgs e)
        {
           //void Uploader_FileUploaded(object sender, UploaderEventArgs args)
          //file move code
         }
     
    5) how to implement required field validation check for file selection by the uploader component.
     
    so that form is not submited without uploading a file.
     
    thanks.

     
     
     

     
     
View Complete Thread