Results 1 to 7 of 7

Thread: Display progress bar

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Display progress bar

    I have a web page where the user selects certain criteria, then clicks a submit button.
    VB Code:
    1. Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ServerClick
    2.         Session("BegDate") = DTPicker1.Text
    3.         Session("EndDate") = DTPicker2.Text
    4.         Session("Store") = cmbStores.SelectedItem.Text
    5.         Session("Process") = "Store_Departments"
    6.         Response.Redirect("Processing.aspx")
    7.     End Sub
    This redirects to a web page with a progress bar on it. When the page loads, it fires off a function that runs.
    VB Code:
    1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         Functions()
    3.     End Sub
    4.     Private Sub Functions()
    5.         Select Case Session("Process")
    6.             Case "Store_Departments"
    7.                 Dim f As New Functions
    8.                 f.fncStore_Departments(Session("BegDate"), Session("EndDate"), Session("Store"), Request.Cookies("EmpID").Value, Session("DistStores"))
    9.                 Response.Redirect("Store_Departments.aspx")
    10.         End Select
    11.     End Sub
    Now, all this works except for one thing. The page that I redirect too with the progress bar, never displays for some reason. Can someone tell me why?

    Thanks
    David Wilhelm

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Does the user ever actually end up at Store_Departments.aspx?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612
    They start at Store_Departments.aspx, then I wanted to redirect to the Processing page with the animated gif file of a progress bar, than I was trying to redirect them back to Store_Departments.aspx after the function was complete.

    The Processing.aspx page never displayed.
    David Wilhelm

  4. #4
    Hyperactive Member greg_quinn's Avatar
    Join Date
    Nov 2002
    Location
    South Africa
    Posts
    366
    Are you sure there is not something recursive going on here, that one page is redirecting to itself on page load?

    What happens if you go to store_departments.aspx manually afterwards?

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612
    I have 2 web pages, 1 functions .vb file, and after it all runs I re-direct to my report.

    Web page 1.
    VB Code:
    1. Session("BegDate") = DTPicker1.Text
    2.         Session("EndDate") = DTPicker2.Text
    3.         Session("Store") = cmbStores.SelectedItem.Text
    4.         Session("Index") = cmbStores.SelectedIndex
    5.         Session("Process") = "Store_Departments"
    6.         Response.Redirect("Processing.aspx")
    As you can see, this puts some data in some session variables and then redirects to the web page Processing.aspx which has this code it.
    VB Code:
    1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         If Not IsPostBack = True Then
    3.             Image2.Visible = True
    4.         End If
    5.         Functions()
    6.     End Sub
    7.     Private Sub Functions()
    8.         Select Case Session("Process")
    9.             Case "Store_Departments"
    10.                 Dim f As New Functions
    11.                 f.fncStore_Departments(Session("BegDate"), Session("EndDate"), Session("Store"), Request.Cookies("EmpID").Value, Session("DistStores"))
    12.                 Response.Redirect("Store_DepartmentsRptView.aspx")
    13.         End Select
    14.     End Sub
    This is the page where I want the image2 to display while the function runs. When the function is complete the last thing it does is redirect to the webpage with displays the report.

    As I said before, all this runs. The function runs and the report displays. All with no errors. The only problem is the Processing.aspx page never displays.

    Thanks for your time.
    David Wilhelm

  6. #6
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    You won't be able to do that. The server buffers the output and doesnt send it until all processing has finished (correct me if im wrong people).

    Because of this the client is never actually redirected to the progress page.

    Off top of my head the only ways around this I can think of are;

    a) Theres a client tag that can force the client to redirect from a page after a specified period of time. So on users data submission you would redirect to the progress bar page and let the processing terminate so the client gets the page + image. Then the tag after say 1 second the client redirects to the actual processing page and once complete, they'll get the result.

    I think thats what the "search" function on this forum does...?

    b) Do the above but start the processing of data in a seperate thread just before you redirect the client to the progress bar. Then on client-redirect from the progress bar it would load a cached results page generated by the thread.

    I have never done the above 2, off top of my head they are the ways I would attempt it.

    Also I noticed you are doing
    VB Code:
    1. Dim f as new function
    2. f.myfunction

    if your function class is literally a list of functions then declare the functions in the class as "Shared" then will not need to instantiate anything and just get away with

    VB Code:
    1. function.myfunction

    or if you do imports.function then you'll only have to do "myfunction"

    If not then I'll shutup. Its lunchtime and I'm bored. I'm also trying to convince my boss that the program I'm writing should be ASP.NET instead of VB.NET but he's not buying it (I like asp.net)

    chow

  7. #7
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    in fact it looks like this forum does do (a) and possibly (b)

    The tag is (contained in the <head></head>) tags e.g:

    <meta http-equiv="Refresh" content="1; URL="/target.aspx?showresult=123456">

    I'd do an example but boss somehow knows when I'm skiving on the web (lunch time over

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width