After clicking the search button on the current page, the button onclick event of the current page will generate a sql statement and then go to the query results page. Since the query may be time-consuming, the customer requires that a reminder be added to these two pages to indicate that the user is querying. Please wait for the page,
The specific query is performed in Page_Load of the query results page.
The current problem is how to automatically redirect this intermediate page to the query results page. If written in Page_Load, this intermediate page will not be displayed. There are two more pertinent solutions:
the first
1. You can make a public user control, copy the following code, and define the style yourself
<div id='doing' style='Z-INDEX: 12000; LEFT: 0px; WIDTH: 100%; CURSOR: wait; POSITION: absolute; TOP: 0px; HEIGHT: 100%'>
<table width='100%' height='100%' id="Table1">
<tr align='center' valign='middle'>
<td>
<table id="Table2" class="loading">
<tr align='center' valign='middle'>
<td>Loading...</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<script language="javascript">
function ShowWaiting()
{
document.getElementById('doing').style.visibility = 'visible';
}
function CloseWaiting()
{
document.getElementById('doing').style.visibility = 'hidden';
}
function MyOnload()
{
document.getElementById('doing').style.visibility = 'hidden';
}
if (window.onload == null)
{
window.onload = MyOnload;
}
</script>
2. Drag user control 3 into the page
. Add a client click method to the button on the page, as follows
protected void Page_Load(object sender, EventArgs e)
{
this.Button1.Attributes.Add("onclick", "ShowWaiting();");
}
The second type of
first page, such as first.aspx, adds the following js:
<script language="javascript">
<!--
var _tt;
function showSending()
{_tt=window.open("processwin.aspx",'uploadfileprocess',"toolbar=0,location=0,directories=0,status=0,
menubar=0,scrollbars=1,resizable=1,top="+dispHeight+",left="+dispWidth+",width=410,height=200",true);
return true;
}
function closewin()
{
if (_tt!=null)
{
_tt.close();
}
}
//-->
</script>
<body bgColor="silver" onunload="closewin();">
Then, the background code first.aspx.cs
When page_load(), add the following attributes to the retrieval button:
btFileUpload.Attributes.Add("onclick","return showSending()");
The processwin.aspx page is the middle page you want. Write "Waiting..." on it.