|
-
Mar 28th, 2007, 11:26 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [02/03] LoadingPage
hey guys,
i need help in creating loading page. i have an asp.net application, in the process of inserting records into the database, i need a popup msgbox in which to show a message to ask the user to wait for processing. this popup msgbox should be closed automatically after the processing is done. my asp.net application currently work like this:
1) user click on button
2) a function started (it takes 5-10mins)
3) datagrid shows the result
in this stage, user will not know when is the processing is done. so i need to create a popup msgbox to display to the user that the process is running before the result is shown in the datagrid. any idea?
i found some java code in the web, but it doesn't suit my needs. the java code i found shows redirecting to another page instead of a popup msgbox.
-
Mar 29th, 2007, 02:32 AM
#2
Re: [02/03] LoadingPage
When you post back to the server (run your function) the whole page posts back - it does not leave some part of it on the client for you to work with when it returns. AJAX would be the solution i.e - click the button a message is dispalyed and the ajax call to the server is made - in the ajax response to the page you can hide your message and display the data...... If you haven't played with ajax yet google it, you'll probably find a code sample that suits your needs.
-
Mar 29th, 2007, 02:52 AM
#3
Thread Starter
Hyperactive Member
Re: [02/03] LoadingPage
beside ajax, do javascript can do this for me?
-
Mar 29th, 2007, 04:39 AM
#4
Fanatic Member
Re: [02/03] LoadingPage
Depends. If you are using any controls that are server-based (they have the runat="server" tag) then no, JavaScript will not help as the page will still post-back. AJAX will complete the processing without doing a complete postback, thus saving time.
 Life is one big rock tune 
-
Mar 29th, 2007, 05:35 AM
#5
Re: [02/03] LoadingPage
Since you need to show results after it is done, there are two ways.
When the original data page is submitted, submit it to the processing page using AJAX and let it run. Meanwhile, show "Please wait..." or an animated GIF in a div on your page. The processing page should then return a chunk of data which you can use to display in your div as the results.
The other way is to submit the data to a processing page which kicks off a thread to do the processing. It then redirects to a 'please wait' page which refreshes itself every x seconds while checking for a session variable. The thread function will manage the state of the execution using session variables.
-
Mar 29th, 2007, 05:43 AM
#6
Thread Starter
Hyperactive Member
Re: [02/03] LoadingPage
so eventually i may have to go for ajax? okies thanks for the information. =)
-
Mar 29th, 2007, 06:38 AM
#7
-
Mar 29th, 2007, 08:56 AM
#8
Re: [02/03] LoadingPage
Nothing like a buzzword to get you a good job these days.
-
Mar 29th, 2007, 10:24 PM
#9
Thread Starter
Hyperactive Member
Re: [02/03] LoadingPage
im using asp.net 1.1. is there any ajax compatible with it?
-
Mar 30th, 2007, 12:47 AM
#10
Thread Starter
Hyperactive Member
Re: [02/03] LoadingPage
okies i found the ajax library for asp.net 1.1.
but im too new to ajax. my code goes like this:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call Popup()
If radStockUpdate.Checked = True Then
grdStatus.Caption = "Stock Update"
Call StockUpdate()
End If
End Sub
----------------------------------------------------------------------
<Ajax.AjaxMethod()> _
Private Sub Popup()
Dim strPopup As String = "<script language='javascript'>" & _
"window.open('/EIS/LoadingPage.aspx?', " & _
"'CustomPopUp', 'width=600, height=600, scrollbars=yes, resizable=yes')" & _
"</script>"
Page.RegisterStartupScript("PopupScript", strPopup)
End Sub
----------------------------------------------------------------------
Private Sub StockUpdate()
'Update DB
End Sub
This is the Button Click event, which i click the button and the page "Please wait..." popup while waiting the updating of db. But still it's not working, the page will only popup after the updating of db.
p/s : i've included this Ajax.Utility.RegisterTypeForAjax(GetType(Download)) in the Page_Load event at the 1st place.
This is the JavaScript code:
Code:
<script language="javascript">
var iLoopCounter = 1;
var iMaxLoop = 5;
var iIntervalId;
function BeginPageLoad() {
location.href = "<%= Request.QueryString("Page")%>";
iIntervalId = window.setInterval("iLoopCounter=UpdateProgress(iLoopCounter, iMaxLoop)", 500);
}
function EndPageLoad() {
window.close();
window.clearInterval(iIntervalId);
Progress.innerText = "Page Loaded -- Not Transferring";
}
function UpdateProgress(iCurrentLoopCounter, iMaximumLoops) {
iCurrentLoopCounter += 1;
if (iCurrentLoopCounter <= iMaximumLoops) {
Progress.innerText += ".";
return iCurrentLoopCounter;
}
else {
Progress.innerText = "";
return 1;
}
}
</script>
<body bgColor="#efefff" MS_POSITIONING="GridLayout" onload="BeginPageLoad()" onunload="EndPageLoad()"></body>
Any help is greatly appreciated.
-
Apr 1st, 2007, 09:20 PM
#11
Thread Starter
Hyperactive Member
-
Apr 2nd, 2007, 08:37 AM
#12
Re: [02/03] LoadingPage
Why popup anything? Just display "wait..." in a DIV. Then kick off the processing. When the processing is done, show "done!"!
-
Apr 2nd, 2007, 08:26 PM
#13
Thread Starter
Hyperactive Member
Re: [02/03] LoadingPage
so if i want to use popup... the event wont fire?
-
Apr 5th, 2007, 06:18 AM
#14
Re: [02/03] LoadingPage
I'm not sure, as I only have a rough idea about your code. It is very possible that the popup is blocking the main window's execution thread, which is why I suggested that you keep everything in a single window. You do understand, right, that alert()s are modal?
-
Apr 6th, 2007, 04:49 AM
#15
Thread Starter
Hyperactive Member
Re: [02/03] LoadingPage
its in the same window, im not calling the function at any other form/class.
-
Apr 6th, 2007, 05:00 AM
#16
Re: [02/03] LoadingPage
You are:
Dim strPopup As String = "<script language='javascript'>" & _
"window.open('/EIS/LoadingPage.aspx?', " & _
"'CustomPopUp', 'width=600, height=600, scrollbars=yes, resizable=yes')" & _
"</script>"
-
Apr 7th, 2007, 08:35 AM
#17
Thread Starter
Hyperactive Member
Re: [02/03] LoadingPage
oh i thought u were saying the StockUpdate() function. okies, im too new to ajax. could u supply me some code for it? for framework 1.1.
-
Apr 7th, 2007, 12:57 PM
#18
Lively Member
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
|