从asp.net页面打开新窗口。 [英] Opening new window from an asp.net page.

查看:57
本文介绍了从asp.net页面打开新窗口。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net网站。

其中只有两页。

1.Parent page(Default.aspx)2.Child page(Default2 .aspx)



- >我打算在父页面上有一个按钮..我希望每当我点击按钮时,子页面会在另一个小页面中打开父页面上的窗口。





我怎样才能实现它。请告诉我。我从不同的链接尝试了很多Javascript。但是无法通过。



感谢您的期待

解决方案

如果您想在更新中注册它小组使用:



 ScriptManager.RegisterClientScriptBlock( this  .GetType(),  yourScriptName,< span class =code-string>  yourJavaScriptFunctionName() true ); 





如果要在页面加载时注册脚本或不使用更新面板:



 Page.ClientScript.RegisterStartupScript( this  .GetType() ,  yourScriptName  yourJavaScriptFunctionName() true ); 


< blockquote>在Default.aspx页面上试试这个:



 <   html  >  
< head >
< script >
function openpopup()
{
window .open( Default2.aspx
}
< / script >
< / head >
< span class =code-keyword>< body >

< 输入 < span class =code-attribute> type = button value = 打开窗口 onclick = < span class =code-keyword> openpopup() >

< / input > < ; / body >
< / html >





欲了解更多信息,请使用google搜索javascript中的Window.Open()。






试试这个:

 <   asp:按钮    runat   =   server   文本  = 打开新窗口    ID   =  openWindowBtn    OnClientClick   =  window.open('webFormToOpenInNewWindow.aspx' ,'_ blank')    /  > ;  



希望这会有所帮助。


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

解决方案

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);


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.


Hi,

Try this:

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


Hope this helps.


这篇关于从asp.net页面打开新窗口。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆