title: Can I dynamically add buttons to a Jquery UI Dialog box?
body: <p>I am trying to add a new button to a jquery UI Dialog box based upon some input.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>function editTour(ID, myDate) {
  $.post("/Admin/EditTour", { TourID: ID },
          function (data) {
              $('#EditTour').html(data);
              $('#EditTour').dialog({
                  modal: true,
                  width: 400,
                  resizable: false,
                  title: formatDate(myDate),
                  buttons: {
                      "Save": function () {
                        //some junk logic removed
                       },
                      "Cancel": function () {
                          $(this).dialog("close");
                      }
                  }
              });
  
          });   //end post
  }
  </code></pre>
  
  <p>What I want to do in this function is add a "Delete" button if the ID passed in is 0.</p>
  
  <p>I know I can just create a cut and paste copy of the editTour function to manually add in the "Delete" button... but I was hoping for something cleaner.</p>