Welcome Guest Search | Active Topics | Sign In | Register

Calling MultiView SetActiveView does nothing Options
P. Chernoch
Posted: Monday, August 18, 2008 2:16:28 PM
Rank: Newbie
Groups: Member

Joined: 8/18/2008
Posts: 9
I am using a ProgressBar. Inside the server side method handling the request, I poll an object in a separate thread until it is done reading a file from an FTP server, updating the percentage complete as appropriate. This all works fine.

At the end, when the file is completely read, I want to do this:

MultiView1.SetActiveView(View2);

Before I rewrote things to use the ProgressBar, it would cause the other view to load and its page_load to be called, which would commence subsequent processing of the file.

Now that code is never reached. Here is the C# method on the server:

Code: C#
protected void UploadProgressBar1_RunTask(object sender, EO.Web.ProgressTaskEventArgs e)
        {
            string errorMsg = "";
            ErrorMsgLabel.Text = "";
            try
            {
                //System.Threading.Thread.Sleep(10000); // For testing the spinner.
                string url = this.PDFUrl.Text;
                string fetchedFile = null;

                if (!url.ToLower().Contains(".pdf"))
                {
                    errorMsg = "The file to be uploaded must have the extension 'pdf'.";
                    throw new Exception(errorMsg);
                }

                errorMsg = "System error. Unable to retrieve path to temporary file directory.";
                string tempFileLocation = Path.GetTempPath();

                errorMsg = "System error. Unable to compose path to final location for PDF file.";
                string finalFileLocation = Path.Combine(ConfigurationManager.AppSettings["UploadPath"], ClientIdHdn.Value);

                errorMsg = "System error. Unable to test existence of directory which will hold PDF file.";
                if (!Directory.Exists(finalFileLocation))
                {
                    errorMsg = "System error. Unable to create directory which will hold uploaded PDF file.";
                    Directory.CreateDirectory(finalFileLocation);
                }

                // Initiate the process of fetching the named file using FTP.
                FtpHelper ftpHelper = new FtpHelper(url, finalFileLocation);
                _ftpHelper = ftpHelper;
                if (ftpHelper.HasError)
                {
                    errorMsg = ftpHelper.Status;
                    throw new Exception("FtpHelper reports error: " + errorMsg);
                }

                ftpHelper.GetFileAsync();

                while (!ftpHelper.IsDone)
                {
                    e.UpdateProgress(ftpHelper.PercentComplete, null);
                    System.Threading.Thread.Sleep(100);
                }

                FtpHelper.DownloadFileInfo info = ftpHelper.FileInfo;

                if (ftpHelper.HasError)
                {
                    errorMsg = ftpHelper.Status;
                    throw new Exception("FtpHelper reports error: " + errorMsg);
                }

                if (info.FileSize > 0)
                {
                    string basename = Path.GetFileName(info.FilePath);
                    PdfFileNameHdn.Value = basename;
                }
                e.UpdateProgress(100, null);
                ErrorMsgLabel.Text = "";
                MultiView1.SetActiveView(View2);
            }
            catch (Exception ex)
            {
                e.UpdateProgress(100, null);
                ErrorMsgLabel.Text = errorMsg;
                _ftpHelper = null;
                // Cause error message to become visible on web page.
                //throw new Exception(errorMsg);
            }


          }


- Paul
eo_support
Posted: Monday, August 18, 2008 2:20:40 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi Paul,

Please read the comment in the "Server Side Task" sample. Everything is clearly explained there.

Thanks!
P. Chernoch
Posted: Tuesday, August 19, 2008 5:48:23 AM
Rank: Newbie
Groups: Member

Joined: 8/18/2008
Posts: 9
Would the comment you are referring to be in this file:

C:\Program Files\Essential Objects\EO.Web Controls 2007.2\Net20\Samples\CS\Demos\Progress Bar\Server Side Task\Demo.ascx.cs ?

- Paul
eo_support
Posted: Tuesday, August 19, 2008 6:00:46 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Yes. Here is the online version:

http://www.essentialobjects.com/Demo/Default.aspx?path=ProgressBar\_i2

You can switch to "VB.NET" or "C#" tab to see the comment.

Thanks
P. Chernoch
Posted: Tuesday, August 19, 2008 9:50:18 AM
Rank: Newbie
Groups: Member

Joined: 8/18/2008
Posts: 9
Thanks. That got me over the hump. I have a second, smaller issue and opened a seperate thread to deal with it.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.