Click here to Skip to main content
15,942,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Iam trying to view a popup window while clicking on a button, using javascript.But with the following code Iam unable to get a popup window,it just open up another page.Is it possible to modify this code and obtain a popup window?

Code here:-

<%@ Page Language="C#" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

    <script runat="server">

        protected void Button1_Click(object sender, EventArgs e)

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "'http://localhost:49911/UI/Report1.aspx','width=100,height=100,scrollbars=no');", true);

    <html xmlns="">
    <head id="Head1" runat="server">

        <script type="text/javascript">

            function pageLoad() {


        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />

        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />

please Help.
ZurdoDev 29-Nov-12 8:37am    
I would just use an html input button and onclick call a function that does the Or, use the OnClientClick event of your ASP.Net button and after calling call return false; so that the page does not post back.

1 solution

Try the following code
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "'http://localhost:49911/UI/Report1.aspx','_blank','width=100,height=100,scrollbars=no');", true);
Share this answer
danil33 29-Nov-12 22:59pm    
Thanks for the replies.Now also a new page is opening,but in small size.But actually what I want is not a new page just a popup window.On clicking on a button in the popup window will save all the details in the popup and returns to the currentpage.

Sorry for the confusions.

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