title: System.Web.UI.ScriptManager.RegisterStartupScript only getting executed once
body: <p>I have a weird problem. I use JavaScript on a Sharepoint page. I reference following JavaScript code:</p>
  
  <pre><code>var statusId = '';
  var notifyId = '';
  
  function AddNotification(message) {
      notifyId = SP.UI.Notify.addNotification(message, true);
  }
  
  function RemoveNotification() {
      SP.UI.Notify.removeNotification(notifyId);
      notifyId  = '';
  }
  
  function AddStatus(message) {
      statusId = SP.UI.Status.addStatus(message);
      SP.UI.Status.setStatusPriColor(statusId, 'red');
  }
  
  function RemoveLastStatus() {
      SP.UI.Status.removeStatus(statusId);
      statusId = '';
  }
  
  function RemoveAllStatus() {
      SP.UI.Status.removeAllStatus(true);
  }
  </code></pre>
  
  <p>Then when the user clicks a button, a notification should appear with the message "please wait...". Before the calling C# method exits, it should remove the notification. Like this:</p>
  
  <pre><code>protected void SaveButton_Click(object sender, EventArgs e)
  {
         System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "Notif", "AddNotification('" + Core.Classes.ResourceHelper.LoadResource(Core.Classes.ResourceName.PleaseWaitString) + "');", true);
         //Busiess logic...
         if (ActivityDate.SelectedDate == null || //Date required
             ActivityProjectnumber.SelectedIndex == 0 || //Project number required
             ActivityActivity.Text == string.Empty || //Activity description required
             EndTime.SelectedDate.Hour &lt; StartTime.SelectedDate.Hour ||    //
             EndTime.SelectedDate.Hour == StartTime.SelectedDate.Hour &amp;&amp;   //Start time should not be less or equal end time
             EndTime.SelectedDate.Minute &lt;= StartTime.SelectedDate.Minute) //
         {
             StatusSetter.SetPageStatus(Core.Classes.ResourceHelper.LoadResource(Core.Classes.ResourceName.CheckRequiredFieldsString), Core.Classes.ResourceHelper.LoadResource(Core.Classes.ResourceName.WarningString), this.Controls);
             return;
         }
  
         //If business logic passed, save item.
         SaveItem();
  
         System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "Notif", "RemoveNotification();", true); //Problem lies here...
  }
  </code></pre>
  
  <p>The notification is displayed when the user clicks the button. But it doesn't disappear. I debugged the code and the corresponding line is definitely being executed. I suspect it has something to do with me using <code>ScriptManager.RegisterStartupScript</code> two times in one method. But I don't know how to do it otherwise.</p>