I'm maintaining an ASP.NET Web application that was originally created by an outsourcing firm but is now in-house. I've noticed that the previous Developers added several Javascript functions to the Master Page that seem to handle postback events. Here's a code sample -
var isPostBackEvent=false;
function ValidatePostBack()
{
isPostBackEvent=true;
}
function SetPageModified()
{
setContainerFieldValueById('ctl00_','pageModified', trueString());
}
And here's an example of how these functions are called in the code -
<asp:Button ID="btnSave" runat="server" Text="Save Record" Font-Names="Verdana" Width="115px" OnClientClick="ValidatePostBack();" Font-Size="9pt"/>
As far as I can tell, the functions do the following:
SetPageModified: Adds a flag to a web server control that indicates whether the entire webpage has been modified by the user.
ValidatePostBack: Adds a flag to a web server control indicating whether a postback event has occurred.
I'm trying to figure out two things -
Why someone would add these types of events when they could just as easily be handled using .NET Postback events instead?
And whether or not these Javascript Postback events interfere with any .NET Postback events?