Click here to Skip to main content
15,903,388 members
Please Sign up or sign in to vote.
1.24/5 (3 votes)
See more:
How can I create a Modal window where I can register a page in java script?


Please help me to create this.
Posted
Comments
VishwaKL 26-Aug-13 3:24am    
Please Elaborate the question with proper description
Sergey Alexandrovich Kryukov 26-Aug-13 3:47am    
There is no such thing as "java script": Java is not a scripting language ;-)
There is no such thing as "register a page".
—SA

1 solution

Step 1: Frist create a div.

XML
<div id="dialog"  style="display: none">
                    <iframe id="showpage" runat="server" height="400" width="650" src=""></iframe>
                </div>
                <asp:HiddenField ID="hdnPopUp" runat="server" />
    </div>


Step 2: Create a Java script function

C#
function showDialog() {
          $(function () {
              // Dialog
              $('#dialog').dialog({
                  modal: true,
                  //autoOpen: false,
                  width: 650,
                  hight: 400,
                  close: function (event, ui) {
                      $('#dialog').hide(); document.getElementById('<%=BtnGo.ClientID%>').click();
                      //parent.location.href = parent.location.href;
                  },
                  open: function (event, ui) {
                      $('#dialog').show();
                      $(this).parent().children().children('.ui-dialog-titlebar-close').hide();
                  },
                  buttons: [{
                      text: "close",
                      click: function () {
                          $(this).dialog("close");
                      }
                  }
                  ]

              });
              // Dialog Link
          });
          }


Step 3: Here Hidden field work as a Flag.
set the flag/hidden field value as 0 in Page load event.

C#
if (!string.IsNullOrEmpty(hdnPopUp.Value) && hdnPopUp.Value.Equals("1"))
            {
                hdnPopUp.Value = "0";
            }


Step 4:
register the page and set the hidden field value 1. means set the status value as 1.
C#
String csname2 = "ViewPopUp";
           System.Type cstype2 = this.GetType();
           ClientScriptManager cs2 = this.ClientScript;
           if (!cs2.IsStartupScriptRegistered(cstype2, csname2))
           {
               String cstext2 = "showDialog();";
               showPrintpage.Attributes.Remove("src");
               showPrintpage.Attributes.Add("src", "About.aspx?id=" + 1);
               cs2.RegisterStartupScript(cstype2, csname2, cstext2, true);
               hdnPopUp.Value = "1";

           }
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900