1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

how to open a new browser window

Discussion in 'ASP.NET' started by shyam_oec, Nov 13, 2009.

  1. shyam_oec

    shyam_oec New Member

    Joined:
    Nov 26, 2007
    Messages:
    89
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Software Developer, .NET Framework
    Location:
    Jamshedpur
    dear sir,
    i want to open a new browser window at the click of the button/link in asp.net using C#.
    kindly explain the detailed procedure for the same.thanking you
     
  2. venami

    venami New Member

    Joined:
    Dec 26, 2008
    Messages:
    195
    Likes Received:
    10
    Trophy Points:
    0
    Occupation:
    Software Professional
    Location:
    India, Tamil Nadu, Cuddalore
    Home Page:
    Hi,

    If you can achieve this using a simple Javascript.

    Code:
    <form action="" method="post">
    <input type="submit" value="submit" [COLOR="Blue"]onclick="window.open();[/COLOR]" />
    </form>
    
     
    shabbir likes this.
  3. urstop

    urstop New Member

    Joined:
    Oct 17, 2007
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    0
    As Venami has mentioned you can use the onclick if its a normal html control, but, if its a .NET button or link button control you will have to use the onclientclick instead of onclick. Everything else remains the same.
     
  4. shyam_oec

    shyam_oec New Member

    Joined:
    Nov 26, 2007
    Messages:
    89
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Software Developer, .NET Framework
    Location:
    Jamshedpur
  5. venami

    venami New Member

    Joined:
    Dec 26, 2008
    Messages:
    195
    Likes Received:
    10
    Trophy Points:
    0
    Occupation:
    Software Professional
    Location:
    India, Tamil Nadu, Cuddalore
    Home Page:
    Hi Urstop,

    Since I have used the Javascript, should the onclick event be changed as you said for .NET?
    Won't Javascript work with .NET?
     
  6. raqman

    raqman New Member

    Joined:
    Sep 24, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    current browser security settings require that a window only be opened from
    href with a target, or client script tied to a onclick event. this prevents
    the old trick of spewing inline javascript to open the window.

    you need to find another approach. you should pass the id down in the
    original render, and have client script determine the correct value, or just
    render a link the user clicks on to open the window.

    __________________
    RAQ ReportFree Excel-like Web-based Java reporting tool
     

Share This Page