While overseeing an ASP.NET Web application originally built by an outsourcing firm but now managed in-house, I've come across some Javascript functions added to the Master Page to handle postback events. Here's a snippet of the code -
var isPostBackEvent=false;
function ValidatePostBack()
{
isPostBackEvent=true;
}
function SetPageModified()
{
setContainerFieldValueById('ctl00_','pageModified', trueString());
}
Here is an instance of how these functions are utilized in the code -
<asp:Button ID="btnSave" runat="server" Text="Save Record" Font-Names="Verdana" Width="115px" OnClientClick="ValidatePostBack();" Font-Size="9pt"/>
Based on my analysis, it appears that:
SetPageModified: Attaches a flag to a web server control indicating whether the entire webpage has been edited by the user.
ValidatePostBack: Sets a flag on a web server control signifying whether a postback event has transpired.
I'm working on unraveling two inquiries -
Why opt for these types of events when .NET Postback events could serve the purpose just as well?
And do these Javascript Postback events disrupt any .NET Postback events?