It's easy enough to detect whether a PostBack has occurred client-side:
In the aspx file:
<form id="Form1" method="post" runat="server">
<p>
<asp:button id="postBackButton" runat="server" text="PostBack"></asp:button>
</p>
<p>
<input type="button" value="Check for PostBack" onclick="JavaScript: alert('IsPostBack: ' + isPostBack());">
</p>
<input type="hidden" id="clientSideIsPostBack" name="clientSideIsPostBack" runat="server">
<script type="text/javascript">
function isPostBack()
{
if ( !document.getElementById('clientSideIsPostBack') )
return false;
if ( document.getElementById('clientSideIsPostBack').value == 'Y' )
return true;
else
return false;
}
</script>
</form>
In the aspx.cs file:
private void Page_Load(object sender, System.EventArgs e)
{
if ( this.IsPostBack )
this.clientSideIsPostBack.Value = "Y";
else
this.clientSideIsPostBack.Value = "N";
}
NC...