title: Show alert before confirmation
body: <p>I want to display an alert first and then show the confirmation box.
  The alert should only be displayed if the treeview contains childnodes.</p>
  
  <p>Here is my code so far, the code shows confirmation box first and then alert. Is there any way to switch them around so the alert is shown before confirmation?</p>
  
  <pre><code>//shows the confirmation box
      if (!Page.IsPostBack)
                  {              
                          btn_save_delete.Attributes.Add("onclick", "return confirm('Deleting the Selected Item will also delete any existing Children under it! Confirm Changes?');");
                     }
  </code></pre>
  
  <p>//shows the alert message</p>
  
  <pre><code>protected void btn_save_delete_Click(object sender, EventArgs e)
          {
  
              if (tree_items.SelectedNode.ChildNodes.Count &gt;= 1)
              {
                  ScriptManager.RegisterStartupScript(this.tree_items, typeof(string), "Alert", "alert('Message here');", true);
              }
              else
              {
                  ScriptManager.RegisterStartupScript(this.tree_items, typeof(string), "Alert", "alert('Message here2');", true);
              }
  }
  </code></pre>
  
  <p>Thank you</p>
  
  <p>Further detail:</p>
  
  <p>I have a tree view and a delete button on the webpage.
  The tree view loads with parent nodes and child nodes.
  If I click on delete after selecting a parent node with child nodes, it should give me an alert and then a confirmation box. If I select a child node or a parent node without any child nodes then it should only show me the confirmation box.</p>