Click here to Skip to main content
12,633,336 members (32,814 online)
Rate this:
Please Sign up or sign in to vote.
See more: Javascript
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.
Posted 29-Nov-12 2:42am
ryanb31 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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try the following code
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "'http://localhost:49911/UI/Report1.aspx','_blank','width=100,height=100,scrollbars=no');", true);
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.161208.2 | Last Updated 29 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100