How to open popup window in ASP.NET

1. Write the following ASP.NET code in the code behind file:

C# in Depth, 3rd EditionManaged Windows VPS Hosting

void Page_load(object sender, EventArgs e)
Button1.Attributes.Add( “onclick”, “popWindow()” );

2. TheĀ .aspx page shoud contains popup JavaScript function:

function popWindow(){‘’, ”, ”);”);
<form runat=”server”>
<asp:Button id=”Button1″ onclick=”Button1_Click” runat=”server” Text=”Run”></asp:Button>

When you click on the button the new popup Window will appear with the desired URL address.