Open New Pop-Up Window from Server Side (Code Behind) in ASP.Net using C#

In this article, I will explain how to open new popup window from Server Side (Code Behind) in ASP.Net using C#.In order to open a new popup window from Server Side (Code Behind), we need to use the ClientScript RegisterStartupScript method to register the JavaScript method to open new window.

Source Code:-

<asp:Button ID="btn" runat="server" Text="Open new pop up window"
        onclick="btn_Click"  />


Code behind(c#)
string page = "newpopup.aspx";
        string open = "window.open('" + page + "', 'popup_window', 'width=300,height=100,left=100,top=100,resizable=yes,toolbar=no,scrollbars=no,');";
        ClientScript.RegisterStartupScript(this.GetType(), "script", open, true);
   


Out-Put:-

Open New Pop-Up Window from Server Side (Code Behind) in ASP.Net using C# Open New Pop-Up Window from Server Side (Code Behind) in ASP.Net using C# Reviewed by NEERAJ SRIVASTAVA on 5:48:00 PM Rating: 5

No comments:

Powered by Blogger.