Creating new browser instance

Discussion in 'ASP.NET / ASP.NET Core' started by mergence, Jun 17, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Any help greatly appreciated.

    I need to be able to launch a new browser instance when user clicks a button. Pretty simple concept - a new IE window gets launched using a specified url. I've tried using Process.Start and this does create a new IE process but never displays it. I cannot see any property like "show" etc for displaying the window. ('Visible'=true of course.) Is there a better way to do this?

    I know I can create a link with the target frame as a new window but I need an actual event to process some data before launching the new browser and the hyperlink control doesn't have a click event. I could use the Javascript 'open' func on a standard html button click but again I need to trap the event.

    What I'd really like to do is create the new page object and set some collection properties in it first, then launch it as a new browser instance. This is how it should work but how do you do it?













    James Nye
     
  2. I am doing something similar in a page on my site. The way to do it is to stick a literal at the top of the page and then when the button is clicked, process that button and render the javascript. When the page is rendered, the javascript will execute. If you need to pass values to your page do it in the query string. So your Click event would look something like:

    private void btnPopup_Click(...){
    // do some stuff
    string javaScript = "<script language='javascript'>";
    javaScript += "newWindow=window.open('MyPage.aspx?arg1=1&arg2=2'," +
    'newWindow','width=100,height=100');newWindow.focus();";
    javaScript += "</script>";
    Literal1.Text=javaScript;
    }

    Cheers!

    Peter

    Disclaimer: The above code I just made up on the fly, so cutting and pasting may reveal errors or tyops.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page