Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 10th, 2004, 01:13 AM
Authorized User
 
Join Date: Mar 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Loading ...

hi allz,

really this site is so powerfull, i wanna thank all the people who help the others to solve there problems.

my question is: when i wanna retrieve data using a query and the data maybe huge or little so how can i let the user know that the site still retrieving data and it is not hanging.
on another words how can i put a LOADING text or picture till the data appears.

thanks in advance

 
Old April 10th, 2004, 12:03 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I usually do this with the use of a page before the page that's retrieving the data. Instead of going directly to the heavy page, first you go to this lightweight "message" page, and then that page directs to the heavy page. You have to use a meta tag refresh instead of a response redirect for this however, otherwise you'll never see the "loading..." message on the message page.

Alternatively, you can response write "loading..." to the response buffer and flush the buffer. This will cause everything in the response buffer to be sent to the browser. The one thing you have to be careful of with this technique is that some browsers require all the HTML before they will start rendering the page. So if the "loading..." text were in a table cell, you would need to ensure that the table HTML is complete before you get to the point in your ASP code where you beginning the lengthy processing. Also, there's no immediate way in ASP to erase the "loading..." message once the processing is complete. You could do it with some javascript and DHTML but you might not be familar with or want to do this. This is why the first suggestion is often better. When the heavy page finishes processing the message page will dissappear.

Peter
-------------------------
Work smarter, not harder
 
Old April 12th, 2004, 12:47 AM
Authorized User
 
Join Date: Mar 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi allz,

thanks alot planoie, it seems a good idea.

mmmmmmmm... i think i must try it now and i will reply u as soon as
it success ( i'm talking on the first idea ).
about the second one i havent enough idea about the flush and buffer, but i will try them out.


thanks alot.



 
Old April 12th, 2004, 03:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You might like to check this thread out! Be aware it is not all links in this thread which is still active. However this still is, and it gives a small example of what I tried to do at that time (not tested in all browsers).

The method has to do with what Peter describes about the response buffer!

Hope it helps.

Jacob.
 
Old April 13th, 2004, 01:29 AM
Authorized User
 
Join Date: Mar 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi allz,
thanks alot planoie for yr help ,but i wanna tell u that yr idea is so nice ,but i cant do it coz i have 2 pages the first one is a form and i search for a name in a database like the letters i type in the textbox, then this form goto the nextpage - using get methode - which will apear the data retreived from the database ( when i query i donna know hom many records will back to me ) so when i made another page which will apear a gif animation and loading text and in the top of the page i put name = request.querstring("name") and i tell the firstpage to not to goto to the secondpage but to goto the search page and in the search page i put a meta redirect to the nextpage - just its name with the parameter -.
so when i type letters and press search i will go to search page and it appears to me an error then redirect me to the result ( nextpage ).
thats all.

thanks alot jacob i try the progress bar ,but i wanna tell u that i put the code before my process and it success on the small result but when u ask for examble on name containing some letters and the result will be huge it dose not work correctly.

thanks again guys.
 
Old April 13th, 2004, 03:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am not sure from where you got the code for the progress bar, but here it is...
Code:
<%
    Response.Buffer = False
    Server.scriptTimeout = 250000
    iProcessedSoFar = 0
    iTotalRecords = 10000
%>

<HTML>

<HEAD>
    <STYLE>
        BODY            { background-color:#FFFFFF; font-family:verdana; }
        #progressBar    { font-size:8pt; font:bold; border-style:solid; border-width:1px; border-color:#888888; padding:1px; text-align:center; }
        #progbar        { height:6px; }
    </STYLE>
</HEAD>

<BODY>

    <TABLE WIDTH='100%' HEIGHT='100%'>
    <TR>
        <TD ALIGN='middle' VALIGN='center'>
        <SPAN ID='progressBar' STYLE='width:350px;'>
            <TABLE STYLE='color:red;' CELLPADDING='0' CELLSPACING='0' BORDER='0'>
            <TR>
                <TD ID='progbar' BGCOLOR='red'></TD>
            </TR>
            </TABLE>
        </SPAN>
        </TD>
    </TR>
    </TABLE>
    <script language="Javascript">var progBarWidth=350</script>
<%
For i = 0 to iTotalRecords
    iProcessedSoFar = iProcessedSoFar + 1
    pctComplete = (iProcessedSoFar/iTotalRecords)
    ShowProgress 2, i, pctComplete    
Next
FinishProgress

Sub ShowProgress(frequency, i, nPctComplete)
    If i mod frequency = 0 Then
        nPctComplete = Replace(CStr(nPctComplete), ",", ".")
        Response.Write "<SCRIPT LANGUAGE='JavaScript'>progbar.style.width = Math.ceil(" & nPctComplete & " * progBarWidth);</SCRIPT>" & vbCrLf
    End If 
End Sub

Sub FinishProgress
    Response.Write vbCrLf & "<SCRIPT LANGUAGE='JavaScript'>document.getElementById('progressBar').innerHTML = 'finished';</SCRIPT>"
End Sub
%>

</BODY>
</HTML>
Be aware that you have to figure out if your ISP uses '.' or ',' as marker for decimals (see other thread).

Hope it helps

Jacob.

 
Old April 13th, 2004, 12:40 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I'm a little confused by your description of your pages, but here's what you should have:

[u]Search page</u>
- show search form
- form posts to "loading" page

[u]Loading page</u>
- show loading message
- write out meta refresh to actual search query page. The meta tag's URL will need to include the search term and any other querystring arguments that the query page needs:
<meta HTTP-EQUIV="REFRESH" CONTENT="0;URL=dosearch.asp?query=searchstring">

[u]Actual query page</u>
- execute the query that may take a long time

This is the basic idea. Hopefully this will explain better what my original suggestion was.

Peter
-------------------------
Work smarter, not harder
 
Old February 8th, 2005, 02:50 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, Peter,

I try the first way using Meta tag. In the lightweight page, insteading of "loading" text, I also have a image just like a progress bar. If no <Meta> tag, the image behaves exactly like a progress bar(there is a green bar keep moving), but with the <Meta> tag, the green bar stop, not moving, is there anyway to do them both?
I hava a large task that will take some time, how can I use progress bar? for many small task, I know how to do it.

Thanks!

Andraw






Similar Threads
Thread Thread Starter Forum Replies Last Post
Access without loading? tal Javascript 1 July 2nd, 2007 01:55 PM
Loading Error. Jack2Black Pro Visual Basic 2005 0 June 10th, 2006 10:33 AM
File Down Loading kvingupta Beginning VB 6 0 March 8th, 2006 07:33 AM
Simulate Loading... alyeng2000 ASP.NET 1.0 and 1.1 Basics 0 March 23rd, 2004 04:29 AM
Dymanic loading tgopal Javascript 1 November 5th, 2003 09:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.