Click here to Skip to main content
12,948,130 members (88,206 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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 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
Top Experts
Last 24hrsThis month
OriginalGriff 5,344
CHill60 3,275
Maciej Los 2,703
Jochen Arndt 1,935
ppolymorphe 1,795


Advertise | Privacy | Mobile
Web02 | 2.8.170524.1 | Last Updated 26 Dec 2012
Copyright © CodeProject, 1999-2017
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