C# 在新页面中创建 ASP.NET 内容,(弹出窗口)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17418618/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating ASP.NET content in a new page, (pop up window)
提问by HOY
I have an ASP.NET button which displays a report (a datatable and binded to my gridview) on my default.aspxpage.
我有一个 ASP.NET 按钮,它在我的default.aspx页面上显示一个报告(一个数据表并绑定到我的 gridview)。
However I want it to show it in a new page, and when button is clicked again, it should open a third page.
但是我希望它在新页面中显示它,当再次单击按钮时,它应该打开第三页。
How to do that ?
怎么做 ?
回答by Carlos Landeras
You can use javascript, (Window.Open) to get it open in a new page. Check this example:
您可以使用 javascript, ( Window.Open) 在新页面中打开它。检查这个例子:
回答by C Sharper
You can use javascript's window.openproperty for this purpose.
window.open为此,您可以使用 javascript 的属性。
You will have to use window.open on clientclickof button so that it will open window as a pop up.
您必须在clientclick按钮上使用 window.open以便它会以弹出窗口的形式打开窗口。
It will be as below:
它将如下所示:
window.open('default.aspx','name','width=200,height=200');
EDIT:
编辑:
Can also try as follows:
也可以尝试如下:
protected void Button_Click(object sender, EventArgs e)
{
Response.Write("<script language=javascript>child=window.open('default.aspx');</script>");
Response.Write("<script language=javascript>child=window.open('default1.aspx');</script>");
}
回答by zey
回答by khalid khan
write two pages from one page open another page in popup using the link below..
after you have passed the id to the popup get it like this
request.Querystring["Id"].tostring();
使用下面的链接从一个页面写两个页面在弹出窗口中打开另一个页面..
在你将 id 传递给弹出窗口后得到它像这样 request.Querystring["Id"].tostring();
<a href="#" onclick="Popup=window.open('yourNewPag.aspx?id='+'<%id to be passed to the popup,e.g. #Eval<"Id"> %>','Popup','toolbar=no, location=yes,status=no,menubar=no,scrollbars=yes,resizable=no, width=700,height=350,left=430,top=23'); return false;">OpenPOPUP</a>

