Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a aspx page as Modal popup

How to open a aspx page as Modal popup.

  1. Test.aspx should open like a modal popup.
  2. Let Test1.aspx has one button. On click it should populate Test.aspx page as Modal popup.

    Here is my button:

    <asp:Button ID="Button1" runat="server" Text="Fill Form in Popup" />
    

NOTE: Test.aspx : Normal aspx page but Test1.aspx: Parent page Contain master page.

like image 233
Sumanta Avatar asked Nov 11 '22 09:11

Sumanta


1 Answers

If you want to open this as jQuery model dialog, see this post

Otherwise, If you want to open this page in a Modal Dialog you can use the following code to open it up. This examples use window.showModalDialog method of javascript. To find details how to use you can refer here.

      <script>
        function fnRandom(iModifier) {
          return parseInt(Math.random() * iModifier);
        }

        function fnSetValues() {
          var oForm = document.getElementById('oForm');
          var iHeight = oForm.oHeight.options[oForm.oHeight.selectedIndex].text;

          if (iHeight.indexOf("Random") > -1) {
            iHeight = fnRandom(document.body.clientHeight);
          }

          var sFeatures = "dialogHeight: " + iHeight + "px;";
          return sFeatures;
        }

        function fnOpen() {
          var sFeatures = fnSetValues();
          window.showModalDialog("test.aspx", "", sFeatures)
        }
      </script>
like image 64
Arafat Avatar answered Nov 14 '22 21:11

Arafat