Friday, March 16, 2012

Login Progress Bar

I have a unique issue...
We are using Microsoft Commerce Server and Content Manager on our
eCommerce Site. I have been requested to display a login status (Pic
that says Please Wait) in a control that is located on multiple pages.
Therefore I need to embed a code segment to be executed when a specific
button is pressed to display the "Please Wait" without having to wait
for the postback to finish.
I am looking to do this in a client side script that is usable by most
browsers. Any assistance or direction would be greatly appreciated.
We are not allowed to use frames (and I agree). The code primarily used
is C#. The following is a code snippet of the button that I need to
capture and execute a client side script:
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 40px; POSITION:
absolute; TOP: 128px" runat="server"
Text="Button"></asp:Button>
A Plan without Action is a DayDream
Action without a Plan is a Nightmare
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!Hi.
Check the net for code regarding Response.Buffering and Response.Flush.
It can be done with these :)
-tom
Something like (you can replace the 'Please Wait' text with an image if
you like):
<%@. Page Language="C#" %>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
btnSubmit.Attributes.Add("onclick",
"document.getElementById('msgWait').style.display='block'");
}
private void btnSubmit_Click(Object sender, EventArgs e)
{
// DO SOME TIME CONSUMING CODE HERE
}
</script>
<html><body>
<form runat="server">
<asp:Button id="btnSubmit" runat="server" Text="Submit"
onclick="btnSubmit_Click" /></p>
</form>
<div id="msgWait" style="display:none; color: red"><p>Please wait.
This may take up to a minute...</p></div>
</html></body>
Ernie wrote:
> I have a unique issue...
> We are using Microsoft Commerce Server and Content Manager on our
> eCommerce Site. I have been requested to display a login status (Pic
> that says Please Wait) in a control that is located on multiple
pages.
> Therefore I need to embed a code segment to be executed when a
specific
> button is pressed to display the "Please Wait" without having to wait
> for the postback to finish.
Daniel M. Hendricks
http://www.danhendricks.com
Thank you,
Initially I looked at using the Response.Buffer and Response.Flush along
with the Document.[Whatever] and these were unable to work in this
scenario. I may be missing something but this specific control is an
embedded HTML control on the Form. The code behind is executing the
validation within commerce server and therefore I am unable to pull it
out of the code behind to run as part of the C# script on the HTML code
segment.
I somehow need to identify that the button (which has an ID on the
ASPNET page) has been clicked (There is already a click event in the
codebehind).
In a nutshell, the login process can take a lot of time and I want to
display an image/text/animated gif to notify the user that the system is
processing and to please wait.
Thank you for your assistance
Walking on Water and Developing Applications from Specifications are
EASY ==> Only when they are FROZEN
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!
I am also trying to do similar thing like you. I need something that will
tell user to wait, while waiting for query to return the result to display.
I
looked at the code provided by Daniel, but my question how the progress page
will know to redirect to result page.
thanks in advance
"Ernie" wrote:

> Thank you,
> Initially I looked at using the Response.Buffer and Response.Flush along
> with the Document.[Whatever] and these were unable to work in this
> scenario. I may be missing something but this specific control is an
> embedded HTML control on the Form. The code behind is executing the
> validation within commerce server and therefore I am unable to pull it
> out of the code behind to run as part of the C# script on the HTML code
> segment.
> I somehow need to identify that the button (which has an ID on the
> ASPNET page) has been clicked (There is already a click event in the
> codebehind).
> In a nutshell, the login process can take a lot of time and I want to
> display an image/text/animated gif to notify the user that the system is
> processing and to please wait.
> Thank you for your assistance
>
> Walking on Water and Developing Applications from Specifications are
> EASY ==> Only when they are FROZEN
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
>
I am also trying to do similar thing. I want progress page/bar while wating
for query to return the result to display. My question is how the progree
page/bar will know to redirect the page to the result page?
thanks in advance
"Ernie" wrote:

> I have a unique issue...
> We are using Microsoft Commerce Server and Content Manager on our
> eCommerce Site. I have been requested to display a login status (Pic
> that says Please Wait) in a control that is located on multiple pages.
> Therefore I need to embed a code segment to be executed when a specific
> button is pressed to display the "Please Wait" without having to wait
> for the postback to finish.
> I am looking to do this in a client side script that is usable by most
> browsers. Any assistance or direction would be greatly appreciated.
> We are not allowed to use frames (and I agree). The code primarily used
> is C#. The following is a code snippet of the button that I need to
> capture and execute a client side script:
> <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 40px; POSITION:
> absolute; TOP: 128px" runat="server"
> Text="Button"></asp:Button>
> A Plan without Action is a DayDream
> Action without a Plan is a Nightmare
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
>
Progress page AND results page is the very same page. You can think this lik
e the page having two different "modes": progress showing mode when page is
doing something, and results showing mode when page has finished. The key in
this approach is that all is in the same page - you don't do any redirectin
g (but you could if you need to :)
This is how it works: when request is sent to server, browser begins waiting
for servers response stream. Here buffering is needed, because browser does
n't show the completed page unless the response has arrived completely. Thou
gh the servers response is still in the middle of transmission and has not c
ompleted yet, you can "steal" some amount of the incoming stream, flush it t
o browser and thus have the "progress showing mode" visible. At the same tim
e server continues to send the response as soon as it gets it ready. When th
e response has arrived to browser completely, the page is complete and you c
an turn "progress showing mode" (ie. graphics or text) off because it is not
needed at this point. The rest of the page now represents the "results show
ing mode".
Remember that all server-side code gets processed first in asp.net,
thus giving you a chance to dynamically generate progress info for the page.
After server-side code processing comes client-side code, ie. any html-code
or client-side scripts.
One hint: if you se graphics with the progress mode, make sure that they are
as small as possible in bytes so that they would be loaded really fast. Wha
t's the point of having heavy, slow loading graphics on the progress showing
mode if the processing gets finished before fancy graphics reach the browse
r? ;)
-Tom-

0 comments:

Post a Comment