31 August 2006

How To Pop UP An ASP.NET Page In IE (Internet Explorer) - Code Snippet

This is a code snippet that is attached to the click event of an ASP.NET Button. When you click the button in IE (Internet Explorer), it pop-ups a new window. The string sWin = "_blank" allows you to pop-up a new window. The string sURL = "Members.aspx?" is the window which your pop-ups will be based on.
private void Button_Click(object sender, System.EventArgs e) 
{               
                if (appName != null) 
                        { 
                                string sUrl = "Members.aspx?" + "&AppName=" + appName + "";

                                string sWin = "_blank"; 
                                string sWinAttribute = "left=5,top=5,fullscreen=no,toolbar=no,addressbars=no,location=no,scrollbars=yes,statusbar=no,resizeable=yes,width=800, height=800";

                                string strScript =      "var windowObject = window.open('" + sUrl + 

                                        "','" + sWin +"','" + sWinAttribute +"',true); windowObject.focus();"; 
                                Page.RegisterClientScriptBlock("Window",strScript); 
                        } 
} 

Comments

No Comments
Anonymous comments are disabled