title: What are the issues when adding Javascript Postback functions to an ASP.NET Web Application?
body: <p>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 -</p>
  
  <pre><code>    var isPostBackEvent=false;
  
      function ValidatePostBack()
      {
          isPostBackEvent=true;
      }
  
      function SetPageModified()
      {
          setContainerFieldValueById('ctl00_','pageModified', trueString());
      }
  </code></pre>
  
  <p>And here's an example of how these functions are called in the code -</p>
  
  <p><code>&lt;asp:Button ID="btnSave" runat="server" Text="Save Record" Font-Names="Verdana" Width="115px" OnClientClick="ValidatePostBack();" Font-Size="9pt"/&gt;</code></p>
  
  <p>As far as I can tell, the functions do the following:</p>
  
  <ul>
  <li><p>SetPageModified: Adds a flag to a web server control that indicates whether the entire webpage has been modified by the user. </p></li>
  <li><p>ValidatePostBack: Adds a flag to a web server control indicating whether a postback event has occurred.</p></li>
  </ul>
  
  <p>I'm trying to figure out two things -</p>
  
  <ul>
  <li><p>Why someone would add these types of events when they could just as easily be handled using .NET Postback events instead?</p></li>
  <li><p>And whether or not these Javascript Postback events interfere with any .NET Postback events?</p></li>
  </ul>