title: Make error div only shown when set to visible?
body: <p>I have some code to show an alert on condition:</p>
  
  <pre><code>protected void btnSave_Click(object sender, EventArgs e)
  {
      foreach (GridViewRow gvr in gvGroups.Rows)
      {
          CheckBox cbAdmin = (CheckBox)gvr.FindControl("cbAdmin");
          CheckBox cbRemove = (CheckBox)gvr.FindControl("cbRemove");
          Label lblID = (Label)gvr.FindControl("lblID");
          int id;
          bool idValid = int.TryParse(lblID.Text,out id);
          bool isReadOnly = !cbAdmin.Checked;
  
  
          if (idValid)
          {
              Group g = SecurityManager.GetGroup(id);
  
              if (g.IsReadOnly != isReadOnly)
              {
                  bool updateSuccess = SecurityManager.ChangeGroupPermissions(id, isReadOnly);
  
                  var master = Master as KezberProjectManager;
                  if (master != null)
                  {
                      master.ShowErrorAlert("Sample Error");
                  }
              }
  
              if (cbRemove.Checked)
              {
                  bool removeEmpSuccess = SecurityManager.RemoveEmployeesFromGroup(id);
                  bool removeSuccess = SecurityManager.RemoveGroup(id);
              }
          }
      }
  
      BindGrid();
  
  }
  </code></pre>
  
  <p>And this calls:</p>
  
  <pre><code>   public void ShowErrorAlert(string message)
          {
              error_alert.Visible = true;
              lblError.Text = message;
          }
  </code></pre>
  
  <p>When the master page loads:</p>
  
  <pre><code>   if (!IsPostBack)
          {
              success_alert.Visible = false;
              error_alert.Visible = false;
          }
  </code></pre>
  
  <p>The only issue is, once the alert is shown, even if I dont ask for it to be shown next time, it is still there. The way I need it is, 1  call to ShowErrorAlert should only show it once, after, if I click the save button but no changes are made, then the show method is not called and it should not show up.</p>
  
  <p>Is there a way to do this?</p>
  
  <p>Thanks</p>