Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
4.00/5 (1 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

If you want to register it inside an update panel use:

C#
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "yourScriptName", "yourJavaScriptFunctionName()",true);


If you want to register the script on page load or without update panel use:

C#
Page.ClientScript.RegisterStartupScript(this.GetType(), "yourScriptName", "yourJavaScriptFunctionName()",true);
 
Share this answer
 
ASP.NET
<asp:linkbutton id="lnkBtn" runat="server" text="linkmeButton" onclientclick="window.open('Default2.aspx')"></asp:linkbutton>
 
Share this answer
 
v2
Hi,

Try this:
ASP
<asp:Button runat="server" Text="Open new window" ID="openWindowBtn" OnClientClick="window.open('webFormToOpenInNewWindow.aspx','_blank')" />

Hope this helps.
 
Share this answer
 
v2
Try This on your Default.aspx page:

HTML
<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.
 
Share this answer
 
Comments
Member 9581909 25-Dec-12 5:03am    
how can I register this script on the backend in c# code.?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900