open new browser window - asp.net

Discussion in 'ASP .Net' started by sri_san@mailcity.com, Apr 25, 2005.

  1. Guest

    Hello,
    I am working on a page where I need to open a new webpage on a
    button click. I tried using javascript's window.open but with popup
    blocker enabled, it doesnt seem to work. Any way to get away with the
    popup blocker?

    This is being used to generate some business reports and not with
    bad intension.

    Any help would be great!!
    Sam.
     
    , Apr 25, 2005
    #1
    1. Advertising

  2. TDAVISJR Guest

    The pop-up blocker is doing what it suppose to do, to get around it you
    probably have to turn it off or tell it to not block pop-ups for this
    website. You can't have it both ways.

    --
    TDAVISJR
    aka - Tampa.NET Koder


    <> wrote in message
    news:...
    > Hello,
    > I am working on a page where I need to open a new webpage on a
    > button click. I tried using javascript's window.open but with popup
    > blocker enabled, it doesnt seem to work. Any way to get away with the
    > popup blocker?
    >
    > This is being used to generate some business reports and not with
    > bad intension.
    >
    > Any help would be great!!
    > Sam.
    >
     
    TDAVISJR, Apr 25, 2005
    #2
    1. Advertising

  3. Marina Guest

    Nope, not going to happen as far as I know. Your users will need to allow
    popups on your site.

    <> wrote in message
    news:...
    > Hello,
    > I am working on a page where I need to open a new webpage on a
    > button click. I tried using javascript's window.open but with popup
    > blocker enabled, it doesnt seem to work. Any way to get away with the
    > popup blocker?
    >
    > This is being used to generate some business reports and not with
    > bad intension.
    >
    > Any help would be great!!
    > Sam.
    >
     
    Marina, Apr 25, 2005
    #3
  4. Bruce Barker Guest

    have the button client onclick open the window, or use an anchor

    <button value="Open Report"
    onclick="window.open('myReport.aspx?id=1234')">
    <a href="myReport.aspx?id=1234" target="Popup">Open Report</a>

    -- bruce (sqlwork.com)




    <> wrote in message
    news:...
    > Hello,
    > I am working on a page where I need to open a new webpage on a
    > button click. I tried using javascript's window.open but with popup
    > blocker enabled, it doesnt seem to work. Any way to get away with the
    > popup blocker?
    >
    > This is being used to generate some business reports and not with
    > bad intension.
    >
    > Any help would be great!!
    > Sam.
    >
     
    Bruce Barker, Apr 25, 2005
    #4
  5. You can do it with a hyperlink, like this:

    <a href="SomePage.aspx" target="_blank">Click Me</a>

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    <> wrote in message
    news:...
    > Hello,
    > I am working on a page where I need to open a new webpage on a
    > button click. I tried using javascript's window.open but with popup
    > blocker enabled, it doesnt seem to work. Any way to get away with the
    > popup blocker?
    >
    > This is being used to generate some business reports and not with
    > bad intension.
    >
    > Any help would be great!!
    > Sam.
    >
     
    Steve C. Orr [MVP, MCSD], Apr 25, 2005
    #5
  6. I suggest that you display a prompt to the user of your application asking
    her to enable browser popups for the application.

    "" wrote:

    > Hello,
    > I am working on a page where I need to open a new webpage on a
    > button click. I tried using javascript's window.open but with popup
    > blocker enabled, it doesnt seem to work. Any way to get away with the
    > popup blocker?
    >
    > This is being used to generate some business reports and not with
    > bad intension.
    >
    > Any help would be great!!
    > Sam.
    >
    >
     
    =?Utf-8?B?Sm9yZ2UgTCBNYXRvcw==?=, Apr 26, 2005
    #6
  7. Guest

    Thanks for the reply. I am considering the hyperlink but can I
    superimpose a hyperlink on a command button. In other words, I need to
    have an event handler in the same page so as to do some processing
    before going to the new page. Can it be done?

    Thanks,
    Sam.
     
    , Apr 26, 2005
    #7
  8. Yes it can be done.

    <html>
    <head>
    <script language="javascript">
    function DoProcessing()
    {
    alert('DoProcesssing()');
    }
    </script>
    </head>
    <body>
    <form>
    <a href="somewebpage.htm" onclick="DoProcessing()">click me</a>
    </form>
    </body>
    </html>

    "" wrote:

    > Thanks for the reply. I am considering the hyperlink but can I
    > superimpose a hyperlink on a command button. In other words, I need to
    > have an event handler in the same page so as to do some processing
    > before going to the new page. Can it be done?
    >
    > Thanks,
    > Sam.
    >
    >
     
    =?Utf-8?B?Sm9yZ2UgTCBNYXRvcw==?=, Apr 26, 2005
    #8
  9. Guest

    Sorry for being unclear. The processing would be server side. Any
    ideas?

    Thanks,
    Sam.
     
    , Apr 26, 2005
    #9
  10. Ah, if you are using ASP.NET then use a "LinkButton" and write code for it's
    click event and then make sure to issue a Response.Redirect() to the desired
    web page.

    If you are not using ASP.NET then you'll need to use some javascript to
    perform a form POST to a web page that can perform the processing and then
    redirect to the desired web page.

    (i.e. posting to an ASP page to perform the processing, and setting a hidden
    variable)

    <html>
    <head>
    <script language="javascript">
    function DoProcessing(arg)
    {
    document.all['hiddenarg'].value = arg;
    document.forms[0].submit();
    }
    </script>
    </head>
    <body>
    <form action="process.asp" method="post">
    <input type="hidden" id="hiddenarg" value="">
    <a href="#" onclick="DoProcessing('123')">click me</a>
    </form>
    </body>
    </html>





    "" wrote:

    > Sorry for being unclear. The processing would be server side. Any
    > ideas?
    >
    > Thanks,
    > Sam.
    >
    >
     
    =?Utf-8?B?Sm9yZ2UgTCBNYXRvcyBbTUNTRC5ORVRd?=, Apr 26, 2005
    #10
  11. Guest

    Thanks again for the reply. Response.Redirect wouldnt work for me coz
    I have to open up the rpt in a new webpage.
    I can do the javascript as above and have a hyperlink attached the
    javascript function but I believe the javascript function call and the
    opening of the rpt in a new page would be asynchronous.I believe as
    soon as the script execution is done, one wouldnt have control over the
    sequence of events. In other words, the new page (new browser popup
    window)should open up after the server code is executed. I would want
    the events to be in sync. Example:

    <asp:hyperlink id=hypProcess runat=server onclick="DoProcessing()"
    navigateURL="rpt.aspx" target="_blank"/>

    The function would submit the form but then the rpt.aspx would open up
    independent of the form processing, rite?

    Thanks,
    Sam.
     
    , Apr 26, 2005
    #11
  12. I think you have 2 options here:

    1) use a regular anchor link <a> that has an href that points to the page
    that does the real work and contains the target = "_blank"

    i.e.
    <a href="rpt.aspx" target="_blank"/>

    The rpt.aspx can then do the server side processing that the first page was
    doing.

    2) Use XMLHttp and some javascript to post data to the first page and then
    going to the rpt.aspx.

    <html>
    <head>
    <script language="javascript">
    function PostToServer()
    {
    //Simulate posting to server with XMLHttp - see REF
    for(var i=0; i < 20000; i++)
    {
    window.status = i;
    }

    return true;
    }
    </script>
    </head>
    <body>
    <a href="rpt.aspx" onclick="return PostToServer()"
    target="_blank">click me</a>
    </body>
    </html>

    REF: http://www.4guysfromrolla.com/webtech/110100-1.shtml

    HTH,
    Jorge

    "" wrote:

    > Thanks again for the reply. Response.Redirect wouldnt work for me coz
    > I have to open up the rpt in a new webpage.
    > I can do the javascript as above and have a hyperlink attached the
    > javascript function but I believe the javascript function call and the
    > opening of the rpt in a new page would be asynchronous.I believe as
    > soon as the script execution is done, one wouldnt have control over the
    > sequence of events. In other words, the new page (new browser popup
    > window)should open up after the server code is executed. I would want
    > the events to be in sync. Example:
    >
    > <asp:hyperlink id=hypProcess runat=server onclick="DoProcessing()"
    > navigateURL="rpt.aspx" target="_blank"/>
    >
    > The function would submit the form but then the rpt.aspx would open up
    > independent of the form processing, rite?
    >
    > Thanks,
    > Sam.
    >
    >
     
    =?Utf-8?B?Sm9yZ2UgTCBNYXRvcyBbTUNTRC5ORVRd?=, Apr 26, 2005
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Tm92aWNl?=
    Replies:
    2
    Views:
    6,718
    Alan Ferrandiz Langley
    Jun 9, 2004
  2. Shiperton Henethe
    Replies:
    17
    Views:
    5,496
    Deirdre Saoirse Moen
    May 21, 2004
  3. Gordon
    Replies:
    3
    Views:
    342
    Steven Burn
    Apr 16, 2004
  4. raj
    Replies:
    0
    Views:
    213
  5. PC HUA
    Replies:
    2
    Views:
    469
    PC HUA
    May 19, 2004
Loading...

Share This Page