Home > ASP.Net, Javascript > Open a Popup window from C# Code behind

Open a Popup window from C# Code behind


Hi

try this example to open a popup window from C# code behind

so create an aspx page and add a Button control when i click on it will open a popup window

protected void Button1_Click(object sender, EventArgs e){

   OpenNewWindow("test.aspx");
}

 
public void OpenNewWindow(string url)

{
   ClientScript.RegisterStartupScript(this.GetType(), "newWindow", String.Format("<script>window.open('{0}');</script>", url));
}

Hope this helps

Good Luck

Advertisements
Categories: ASP.Net, Javascript
  1. January 31, 2009 at 6:34 am

    Nice solution thats works fine

  2. yasserzaid
    February 2, 2009 at 9:47 pm

    Hi aliraza

    Thanks for your comment and hope my post helps you

    Good Luck

  3. Nidhi Kumari
    March 9, 2011 at 7:41 pm

    nice solution.it worked, fantastic.thanx

  4. yasserzaid
    March 14, 2011 at 9:30 pm

    @Kumari :- you are welcome

  5. November 22, 2011 at 5:23 am

    fine code

    Thanks

  6. yasserzaid
    December 3, 2011 at 7:06 pm

    @pankaj :- You are welcome 🙂

  7. ram reddy
    March 28, 2013 at 5:37 am

    what is the library we should have to use

    • yasserzaid
      March 28, 2013 at 3:44 pm

      This is Javascript code

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: