|
-
Nov 11th, 2004, 10:08 AM
#1
Thread Starter
Fanatic Member
Display progress bar
I have a web page where the user selects certain criteria, then clicks a submit button.
VB Code:
Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ServerClick
Session("BegDate") = DTPicker1.Text
Session("EndDate") = DTPicker2.Text
Session("Store") = cmbStores.SelectedItem.Text
Session("Process") = "Store_Departments"
Response.Redirect("Processing.aspx")
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:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Functions()
End Sub
Private Sub Functions()
Select Case Session("Process")
Case "Store_Departments"
Dim f As New Functions
f.fncStore_Departments(Session("BegDate"), Session("EndDate"), Session("Store"), Request.Cookies("EmpID").Value, Session("DistStores"))
Response.Redirect("Store_Departments.aspx")
End Select
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
-
Nov 12th, 2004, 06:36 AM
#2
Retired VBF Adm1nistrator
Does the user ever actually end up at Store_Departments.aspx?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Nov 15th, 2004, 11:18 AM
#3
Thread Starter
Fanatic Member
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.
-
Nov 17th, 2004, 11:21 AM
#4
Hyperactive Member
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?
-
Nov 23rd, 2004, 08:45 AM
#5
Thread Starter
Fanatic Member
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:
Session("BegDate") = DTPicker1.Text
Session("EndDate") = DTPicker2.Text
Session("Store") = cmbStores.SelectedItem.Text
Session("Index") = cmbStores.SelectedIndex
Session("Process") = "Store_Departments"
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:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack = True Then
Image2.Visible = True
End If
Functions()
End Sub
Private Sub Functions()
Select Case Session("Process")
Case "Store_Departments"
Dim f As New Functions
f.fncStore_Departments(Session("BegDate"), Session("EndDate"), Session("Store"), Request.Cookies("EmpID").Value, Session("DistStores"))
Response.Redirect("Store_DepartmentsRptView.aspx")
End Select
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.
-
Nov 24th, 2004, 07:58 AM
#6
Hyperactive Member
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:
Dim f as new function
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
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
-
Nov 24th, 2004, 08:04 AM
#7
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|