Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET C#4.0
I have an asp.net website.
There are only two pages in it.
1.Parent page (Default.aspx) 2.Child page(Default2.aspx)
 
->I intend to have a button on the parent page..I want that whenever i click the button,The child page opens in another samll window over the parent page.
 

How can i achieve it.Please tell me.I have tried many Javascript from different links.But couldnt get through.
 
Thank you in anticipation
Posted 24-Dec-12 4:25am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try This on your Default.aspx page:
 
<html>
<head>
<script>
function openpopup()
{
window.open("Default2.aspx ")
}
</script>
</head>
<body>
 
<input type="button" value="Open Window" onclick="openpopup()">
 
</input></body>
</html> 
 
For more information search "Window.Open() in javascript" using google.
  Permalink  
Comments
Member 9581909 at 25-Dec-12 5:03am
   
how can I register this script on the backend in c# code.?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
Try this:
<asp:Button runat="server" Text="Open new window" ID="openWindowBtn" OnClientClick="window.open('webFormToOpenInNewWindow.aspx','_blank')" />
Hope this helps.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

<asp:linkbutton id="lnkBtn" runat="server" text="linkmeButton" onclientclick="window.open('Default2.aspx')"></asp:linkbutton>
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

If you want to register it inside an update panel use:
 
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "yourScriptName", "yourJavaScriptFunctionName()",true);

 
If you want to register the script on page load or without update panel use:
 
Page.ClientScript.RegisterStartupScript(this.GetType(), "yourScriptName", "yourJavaScriptFunctionName()",true);
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 354
1 Richard MacCutchan 310
2 OriginalGriff 275
3 Vinay Mistry 163
4 Jared Sanow 145
0 Sergey Alexandrovich Kryukov 5,939
1 OriginalGriff 4,885
2 CPallini 2,473
3 Abhinav S 1,507
4 Richard MacCutchan 1,437


Advertise | Privacy | Mobile
Web03 | 2.8.140814.1 | Last Updated 26 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100