This has nothing to do with ASP.NET 2.0 since you need client-side script, which will work with any .NET version, to do that. You would have to hijack the entire PostBack process to do it. You would need to use HTML buttons instead of ASP.NET buttons.
Here is an example:
aspx file:
<form id="Form1" method="post" runat="server">
<input type="button" id="submitButton" value="Submit" onclick="JavaScript: startTimedPostBack();">
<span id="timedLabel" style="display:none">This text is displayed within the timed PostBack!</span>
</form>
<script type="text/JavaScript">
<!--
var timerId = null;
function startTimedPostBack()
{
document.getElementById('timedLabel').style.display = 'block';
timerId = window.setTimeout('doTimedPostBack()', 5000); // 1000 = 1 second
}
function doTimedPostBack()
{
document.getElementById('timedLabel').style.display = 'none';
window.clearTimeout(timerId);
__doPostBack('submitButton', '');
}
// -->
</script>
aspx.cs file:
private void Page_Load(object sender, System.EventArgs e)
{
// Insure that the __doPostBack() JavaScript method is created...
this.GetPostBackEventReference(this, string.Empty);
if ( this.IsPostBack )
{
string eventTarget = (this.Request["__EVENTTARGET"] == null) ? string.Empty : this.Request["__EVENTTARGET"];
if ( eventTarget == "submitButton" )
{
submitButton_Click();
}
}
}
private void submitButton_Click()
{
this.Response.Write("submitButton_Click fired. <br>");
}
NC...