Confirm message with wait not working

  1. #1

    Confirm message with wait not working

    Hi Friends,
    I have a file upload control and a upload button in my page. When i click the Upload button the direct event method will fire.. In that i am showing a confirm message whether user wants to upload or not.

    Please try this working code....

    protected void btnUpload_Click(object sender, DirectEventArgs e)
        {
            
            //Confirmation message.
            string confInfo = "Do you want to continue?";
    
            //Check whether file available for upload.
            if (this.FileUploadField1.HasFile)
            {
                string fileName = System.IO.Path.GetFileName(this.FileUploadField1.PostedFile.FileName);
                hdnFileName.Value = fileName;
                int contentSize = this.FileUploadField1.PostedFile.ContentLength;
                string fileExtension = System.IO.Path.GetExtension(FileUploadField1.PostedFile.FileName);
                //Check for file type(MS excel 2003 and MS excel 2007).
                if (fileName != string.Empty && (fileExtension.ToLower().Contains(".xls")||fileExtension.ToLower().Contains(".xlsx")))
                {
                    //Save the file in the filesystem.
                    string filtSavepath = Server.MapPath(".") + "\\UploadedFiles\\" + "File_" + fileName;
                    FileUploadField1.PostedFile.SaveAs(filtSavepath);
                    string path = @"../UploadedFiles/File_" + fileName;
                   
                    
                    X.Msg.Confirm("Confirm the Upload:", confInfo, new MessageBoxButtonsConfig
                    {
                        Yes = new MessageBoxButtonConfig
                        {
                            Handler = "Ext.net.DirectMethods.ContinueUploading()",
                            Text = "Continue Upload"
                        },
                        No = new MessageBoxButtonConfig
                        {
                            Handler = "Ext.net.DirectMethods.CancelUploading()",
                            Text = "Cancel"
                        }
                    }).Show();
    
                }
                else
                {
                    X.Msg.Show(new MessageBoxConfig
                    {
                        Buttons = MessageBox.Button.OK,
                        Icon = MessageBox.Icon.ERROR,
                        Title = "Error:",
                        Message = "Please select excel sheet."
                    });
                }
            }
            else
            {
                X.Msg.Show(new MessageBoxConfig
                {
                    Buttons = MessageBox.Button.OK,
                    Icon = MessageBox.Icon.ERROR,
                    Title = "Error:",
                    Message = "No file found to upload."
                });
            }
        }
    Below are the direct methods...
    [DirectMethod]
        public void ContinueUploading()
        {
          //X.Msg.Wait("Reading....","Read").Show();
            
            //Start reading data from oversight excel sheet.
             ReadExcelfileData();
           
             // X.Msg.Hide();
           
            if (!string.IsNullOrEmpty(lblResults.Text))
            {
                X.Msg.Alert("Error:", lblResults.Text).Show();
            }
        }
    
        [DirectMethod]
        public void CancelUploading()
        {
            string filePathName = @"../UploadedFiles/File_" + hdnFileName.Value.ToString();
            try
            {
                if (File.Exists(Server.MapPath(filePathName)))
                {
                    File.Delete(Server.MapPath(filePathName));
                }
                FileUploadField1.PostedFile.InputStream.Dispose();
                
            }
            catch
            {
                throw;
            }
    
        }
    see the ReadExcelfileData(); method in ContinueUpload directmethod. This is private method which reads the excel sheet. This method takes around 4 to 5 seconds..
    I want to show a wait message in this scenario..... Please help me how to do this... I tried configuring wait message on the server side but no use.


    The user has to wait around 5 seconds to see the results.... How can i solve this problem... Is there any other interactive way to show the message.
    Last edited by Mr.Techno; Aug 05, 2011 at 1:45 PM.
  2. #2
    Hi,

    Maybe you could use ProggressBar:
    https://examples1.ext.net/#/Miscella...r_Side_Update/

Similar Threads

  1. confirm message box problem
    By mehmood in forum 1.x Help
    Replies: 6
    Last Post: Jun 21, 2012, 1:47 PM
  2. Confirm message handler
    By norphos in forum 1.x Help
    Replies: 1
    Last Post: May 18, 2011, 6:51 AM
  3. Replies: 1
    Last Post: Dec 22, 2010, 2:46 PM
  4. [CLOSED] confirm message problem
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 12, 2009, 5:43 AM

Tags for this Thread

Posting Permissions