|
-
Apr 20th, 2006, 08:29 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] How to refresh page every second
Hi guys.
How do I refresh the page every second because my page is not showing because loading to the next page is too long.
Here's what I have done so far.
VB Code:
Page.RegisterStartupScript("Timer", "<script type=text/javascript>setTiemout('document.location=document.location',1000)</script>")
SqlConnection1.Open()
SqlConnection2.Open()
Server.ScriptTimeout = 1000000
SqlSelectCommand2.CommandText = "SELECT t_mobile.t_fullname, t_mobile.t_empNo FROM t_mobile INNER JOIN t_Mmobile ON t_mobile.prime = t_Mmobile.prime WHERE (t_Mmobile.t_month LIKE '%" & MonthStr & "%') AND (t_Mmobile.t_year LIKE '%" & YearStr & "%')"
SqlSelectCommand2.ExecuteNonQuery()
SqlDataAdapter2.Fill(DataSet1)
EmpCount = 100
DataSet1.Reset()
Do While Not LoopCounter = EmpCount
SqlSelectCommand2.CommandText = "SELECT t_mobile.t_fullname, t_mobile.t_empNo, t_mobile.t_total FROM t_mobile INNER JOIN t_Mmobile ON t_mobile.prime = t_Mmobile.prime WHERE (t_Mmobile.t_month LIKE '%" & MonthStr & "%') AND (t_Mmobile.t_year LIKE '%" & YearStr & "%')"
SqlSelectCommand2.ExecuteNonQuery()
SqlDataAdapter2.Fill(DataSet1)
EmpNumber = Trim(DataSet1.Tables(0).Rows(LoopCounter - 1).Item(1))
xcRange = xcWS.Range("B" & LoopCounter + 1)
xcRange.Value = UCase(Trim(DataSet1.Tables(0).Rows(LoopCounter - 1).Item(0)))
Loop
Apprceiate your help.
-
Apr 20th, 2006, 11:22 PM
#2
Thread Starter
Hyperactive Member
Re: How to refresh page every second
Can Smart Navigation solve my problem?
What is Smart Navigation anyway?
-
Apr 20th, 2006, 11:27 PM
#3
Junior Member
Re: How to refresh page every second
Hi
I don't know about your situation.But if you want to refresh a webform ,you can use Meta tag in html page.
use this following Tag...
<meta http-equiv="refresh" content=2>
here 2 is every 2 seconds.you can give whatever you want.
Thanks,
Thiyagarajan.N
-
Apr 20th, 2006, 11:35 PM
#4
Thread Starter
Hyperactive Member
Re: How to refresh page every second
My situation is a webpage is taking too much time to load.
It is so much that you will think that the program hung up on you.
I will try what you have said after the program finished its task.
-
Apr 20th, 2006, 11:47 PM
#5
Thread Starter
Hyperactive Member
Re: How to refresh page every second
 Originally Posted by thiyag2001
Hi
I don't know about your situation.But if you want to refresh a webform ,you can use Meta tag in html page.
use this following Tag...
<meta http-equiv="refresh" content=2>
here 2 is every 2 seconds.you can give whatever you want.
Thanks,
Thiyagarajan.N
Sorry it does not work. It still hungs up on me.
-
Apr 21st, 2006, 12:11 AM
#6
Re: How to refresh page every second
It's taking long because it's timing out and it's not properly looping the DataSet.
You have this:
Do While Not LoopCounter = EmpCount
But inside the loop, you don't increment LoopCounter + 1. So it always stays looping on the same record.
To loop a DataSet, use:
VB Code:
For each dr as DataRow in DataSet1.Rows
..
Next
Also, on your 7 line, you Fill a DataSet, and then two lines later you clear it. That wastes time also.
You are missing a good tune up on that code.
Also, you want to do the oposite than refreshing the screen every 2 seconds. If you do that, every 2 seconds it will load the page. It's going to be imposible to use.
SmartNavigation is mostly targeted to smooth the user interface while performing PostBacks. It's not related to this particular case.
HTH
HoraShadow
Last edited by HoraShadow; Apr 21st, 2006 at 12:16 AM.
I do like the reward system. If you find that my post was useful, rate it.
-
Apr 21st, 2006, 12:20 AM
#7
Thread Starter
Hyperactive Member
Re: How to refresh page every second
Actually I did not posted the whole process because it will take 1000 lines of code and we don't want reading all of that. I have tested the program and it works 100% but the problem still remains that you will wait for more than 10 minutes.
Code tune-up is not my problem as of now.
But I will tune it up when my free time comes. Thanks for your concern.
Currently I am having progress now. I am using the Response.Write and then Response.Flush but I am having errors when I use Response.Redirect.
Can you guys help me.
-
Apr 21st, 2006, 01:57 AM
#8
Thread Starter
Hyperactive Member
-
Apr 21st, 2006, 04:56 AM
#9
Re: How to refresh page every second
Why are u using Response.Write?
Why are u refreshing every second? That's nuts. Refresh every 10-20-30 seconds. Not 1 
You posted code in your 1st post that has nothing to do with page refreshing.
All I see is an evil loop hitting the DB 100x
WOka
-
Apr 21st, 2006, 05:02 AM
#10
Thread Starter
Hyperactive Member
Re: How to refresh page every second
Hmmm.... maybe I should paste all my codes so that you can how long does the process take.
Ok here is the situation....
I have 2 forms.
The first form asks for month and year.
The second form just does the processing and prompts the user to download the excel file.
Fine. Fine. And fine.
The problem left is that the process takes too long so I need some kind of progressbar.
YES a progressbar. (That's the word I wanted to say.)
But the problem is when I use a timer the page does not refresh.
-
Apr 21st, 2006, 05:04 AM
#11
Thread Starter
Hyperactive Member
Re: How to refresh page every second
I can't paste my code. There is a page error appearing.
-
Apr 21st, 2006, 05:08 AM
#12
Re: How to refresh page every second
This is because web is asynchronous.
To do progress bars requires a lot of Java Script and a remote call back, called AJAX in 2005, in 2003 this is very hard to do.
You cannot do a prog bar per-say, but you can create a "In progress" bar that just scrolls.
Using a remote call back here is essential.
This is very complicated stuff 
WOka
-
Apr 21st, 2006, 05:18 AM
#13
Thread Starter
Hyperactive Member
Re: How to refresh page every second
 Originally Posted by Wokawidget
This is because web is asynchronous.
To do progress bars requires a lot of Java Script and a remote call back, called AJAX in 2005, in 2003 this is very hard to do.
You cannot do a prog bar per-say, but you can create a "In progress" bar that just scrolls.
Using a remote call back here is essential.
This is very complicated stuff
WOka
Oh my God! I am such a newbie at this. Do you mean that I will still add a lot of codes just to do this:
1. Pass the counter to the webpage.
2. Refresh page or something.
3. Fill color of table column so that it would look like a progress bar.
Man if that is the case then I would let the user suffer waiting.
-
Apr 21st, 2006, 05:19 AM
#14
Thread Starter
Hyperactive Member
Re: How to refresh page every second
Thanks anyway for the information.
-
Apr 21st, 2006, 05:30 AM
#15
Re: How to refresh page every second
No, you can't pass counters to the web page...well not like what you want to do I think.
This would not work how you want it to.
Web pages are async. What you could do, and i WOULDN'T do this, but i think it's what u're descibing is:
Populate a grid with data.
Flag row in grid to process. (could use viewstate for this)
Set page to refresh every 5 seconds
Check which row to process.
Process row.
Set next row to be processed.
Display page.
Page will refresh and process 2nd row.
This is EVIL! and slow.
You must do the call in a oner, ie one call to server.
Doing this you cannot have a normal window progress bar.
Like I said you can make an "In progress bar" that just scrolls randomly to show the user something is being done.
To do this you must use remote call backs. 2003 doesn't support this, 2005 does.
To do this is 2003 requires lots of evil code, and a decent level of .net programming.
Do a google search for:
ASP.NET remote callback
Web design and apps are VERY VERy different from Win32 applications I am afraid. Many UI stuff cannot be achieved using asp.net that you can do in a windows form.
Woka
-
Apr 21st, 2006, 05:39 AM
#16
Thread Starter
Hyperactive Member
Re: How to refresh page every second
 Originally Posted by Wokawidget
Web design and apps are VERY VERy different from Win32 applications I am afraid. Many UI stuff cannot be achieved using asp.net that you can do in a windows form.
Woka
Couldn't agree with you more. I will not pursue this crazy and evil quest as of now.
-
Apr 22nd, 2006, 04:44 PM
#17
Re: [RESOLVED] How to refresh page every second
Remote Scripting has nothing to do with ASP.NET versions. It's been in use since the early days of the web and has only been rechristened as a brand new buzzword so that people can sell books, just like AJAX.
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
|