title: Need Sharepoint like modal pop-up window
body: <p>I need to show Sharepoint 2010 like pop-up window when clicked on a link in grid view. Once the modal pop-up displayed and user selected the Save button data base should be updated with given values in pop-up. How can I get this. Any Idea.</p>
  
  <p>As of now I am using below code to get it but no idea how to pass the values to Database once clicked on the button in pop-up</p>
  
  <p>Note: As of now I am not adding the gridview code here as I wanted to achieve it first with sample html then wanted to do with grid view.</p>
  
  <p><strong>Java Script</strong></p>
  
  <pre><code>function openDialog() {
  
      var options = {
  
          html: divModalDialogContent,  // ID of the HTML tag
  
          // or HTML content to be displayed in modal dialog
  
          width: 600,
  
          height: 300,
  
          title: "My First Modal Dialog",
  
          dialogReturnValueCallback: dialogCallbackMethod,  // custom callback function
  
          allowMaximize: true,
  
          showClose: true
  
      };
  
      SP.UI.ModalDialog.showModalDialog(options);
  
  }
  
  //Results displayed if 'OK' or 'Cancel' button is clicked if the html content has 'OK' and 'Cancel' buttons
  
  function onDialogClose(dialogResult, returnValue) {
  
      if (dialogResult == SP.UI.DialogResult.OK) {
  
          alert('Ok!');
  
      }
  
      if (dialogResult == SP.UI.DialogResult.cancel) {
  
          alert('Cancel');
  
      }
  
  }
  
  // Custom callback function after the dialog is closed
  
  function dialogCallbackMethod() {
  
      alert('Callback method of modal dialog!');
  
  }
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div id="divModalDialogContent"&gt;
  
      Hello World!
  
      &lt;input type="button" value="OK"onclick="SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, 'Ok clicked'); return false;"
  
          class="ms-ButtonHeightWidth" /&gt;
  
      &lt;input type="button" value="Cancel"onclick="SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel, 'Cancel clicked'); return false;"
  
          class="ms-ButtonHeightWidth" /&gt;
  
          &lt;asp:Button runat="server" ID="btnClicked" Text="Clicked" 
          onclick="btnClicked_Click" /&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;input type="button" value="Open" onclick="openDialog()" /&gt;
  </code></pre>
  
  <p>How can I call db upon clicking 'clicked' button in pop-up. Also I need to send parameters to pop-up</p>
  
  <p>Thanks in advance</p>