How to show 'waiting...' mesage in page after submitting a web form

A

Anonieko

Scenario:

This is a reporting scenario where it takes a while to get
back a response ( report page ) after submit.

I want my user to see some kind of temporary message like
'Processing...' or 'Waiting.. ' after I clicked on a SUBMIT
button to post a web form.


Here is one solution. Anyone who has better?

Create an image button in the page small enough and add a click event
handler for this image button which will redirect to the target page.
The trick is to trigger the click on via javascript on the submit event
handler.



ASPX page has
-------------

...

<P align="center">
<asp:button id="btnSubmit" runat="server" Text="Show
Report"></asp:button>
<BR>
<asp:ImageButton id="triggerControl" runat="server" Width="1px"
Height="1px" ImageUrl="img/unknown.gif" />
<SPAN id="Processing" style="DISPLAY: none">
Please wait while creating report...
</SPAN>
</P>

<SCRIPT type="text/javascript">
var hasSubmitted = 0;
function NoDoubleSubmit() {
var divMsg = document.getElementById('Processing');
if (hasSubmitted == 0) {
hasSubmitted = 1;
divMsg.style.display ='block';
return true;
}
return false;
}
</SCRIPT>

...


THE SERVER ASPX.CS code has these...
-------------------------------------

private void btnSubmit_Click(object sender, System.EventArgs e)
{
bool valid = false;

// Do some validation

if ( valid ) {
triggerControl.Attributes.Add("onclick", "
NoDoubleSubmit();");
}

}

private void triggerControl_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Response.Redirect("ReportTran.aspx");
}



// the extra code above prevents submitting the form twice
 
A

Anonieko

How about another example that goes within the page itself ( and not on
top )
Thanks Again!
 
O

Onin Tayson

You can open a new window for the report so that it will run on a separate
process and you can still continue with other tasks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top