title: Can't prevent ModalDialog to close in SharePoint Web Part
body: <p>I am calling  SP.UI.ModalDialog.showModalDialog() in a javascript function of my Web Part (SharePoint 2010) but the dialog appears for one second, then closes itself.<br>
  Originally, I wanted to call a sharepoint page (in Layouts folder) but I am testing with a simple dialog to make sure it isn't an error in my sharepoint page.</p>
  
  <p>In the Web Part,  I have a table where each first cell row is a LinkButton. I have set the OnClientClick to call a javascript function :</p>
  
  <pre><code>linkButton.OnClientClick = string.Format("OpenNotationCurveDialog('{0}');",
                      notation.code);
  </code></pre>
  
  <p>In the script block of the web part ASCX, I have :</p>
  
  <pre><code>function OpenNotationCurveDialog(notationCode) {
  
      var htmlElement = document.createElement('p');
  
      var helloWorldNode = document.createTextNode('Hello world!');
      htmlElement.appendChild(helloWorldNode);
  
      var options = {
  
          title: "Add item",
          allowMaximize: true,
          showClose: true,
          width: 800,
          height: 600,
          html: htmlElement,
          dialogReturnValueCallback: CurveDialog_ClosedCallback
  
      };
  
      SP.UI.ModalDialog.showModalDialog(options);
  
      return false;
  }
  
  function CurveDialog_ClosedCallback(result, value) {
      console.log('!! CurveDialog_ClosedCallback !!');
  }
  </code></pre>
  
  <p>The function CurveDialog_ClosedCallback is never called.
  In the same Web Part, I have added an element to the Web Part menu that calls the javascript function SP.UI.ModalDialog.showModalDialog() : it is working perfectly. I don't understand why it is working when calling showModalDialog() from the menu and not working from the LinkButton client event.</p>
  
  <p>Any idea how to solve this very annoying behavior ?
  thx</p>