Share Blog

Wednesday, May 14, 2014

How to Open New Browser Window using C#.Net

If you want to open new browser window then you can use this code.

<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" Width="100px" />

protected void Button1_Click(object sender, EventArgs e)
        {
            string Fullurl = "WebForm2.aspx/";
            OpenNewBrowserWindow(Fullurl, this);

        }
//This is used to open new browser window

public static void OpenNewBrowserWindow(string Url, Control control)
{
    ScriptManager.RegisterStartupScript(control, control.GetType(), "Open", "window.open('" + Url +"');", true);
}

No comments:

Post a Comment