title: Javascript alert in C# not working
body: <p>I have few textboxes to view and also update records. Here is my code to check for any duplicate record before save or update &amp; alert the user if there is any. 
  The javascript alert is popping up for 'Update' but not for 'Save'. The debugger even reads the line in the else block. Where am I going wrong?</p>
  
  <pre><code>protected void Save_Click(object sender, EventArgs e)
   {
      int returnId;
      returnId = chkDuplicates(value,1);//function to check for any duplicate value
      if(returnId==0)
        //save the record
      else
       ScriptManager.RegisterStartupScript(this,typeof(Page), "MsgSave", 
                                           "alert('value exists');", true);
   }
  
    protected void Update_Click(object sender, EventArgs e)
   {
      int returnId;
      returnId = chkDuplicates(value,2);//function to check for any duplicate value
      if(returnId==0)
        //update the record
      else
       ScriptManager.RegisterStartupScript(this,typeof(Page), "MsgUpdate", 
                                           "alert('value exists');", true);
   }
  </code></pre>