如何在新页面中使用querystring发送数据? [英] How can i send data with querystring in new page?
本文介绍了如何在新页面中使用querystring发送数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想这样:
当我单击GridView时,它会将ID发送到具有"_blank"目标的新页面.
这是我的代码:
受保护的子GridView4_SelectedIndexChanged(ByVal发送者作为对象,ByVal e作为System.EventArgs)处理GridView4.SelectedIndexChanged
Response.Redirect(〜/details.aspx?id ="&GridView4.SelectedDataKey(0))
结束子
如何添加"_blank"目标.
I wanna this:
when i click on my GridView , it send ID to new page with "_blank" target.
this is my code:
Protected Sub GridView4_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView4.SelectedIndexChanged
Response.Redirect("~/details.aspx?id=" & GridView4.SelectedDataKey(0))
End Sub
how can add "_blank" target.
推荐答案
这里是一种方法:
Here''s one way:
StringBuilder sb = new StringBuilder();
sb.Append("<script language='javascript'>");
sb.AppendFormat("window.open('{0}');", @"http://www.mysite.com/mypage.aspx?id=myID");
sb.Append("</script>");
Response.Write(sb.ToString());
新窗口的打开完全取决于网络浏览器.服务器端重定向将仅发送回发出请求的浏览器窗口.如果要打开新的浏览器窗口,则必须通过javascript或将anchor tag
与target
属性配合使用.
干杯!
-MRB
The opening of new window is entirely at the disposition of the web browser. A server side redirect will only be sent back to the browser window from which the request was issued. If you want a new browser window to open you''ll have to do this either via javascript or by using ananchor tag
with thetarget
attribute.
Cheers!
-MRB
details.aspx?ID = 1
您可以发送由&分隔的任意多的值,就像这样
id = 1&name =诺基亚&email = ....
在details.aspx页面上,您必须执行此操作:
Request.QueryString ["ID"]
details.aspx?ID=1
You can send as many values seperated by &, like this
id=1&name=Nookia&email=....
On the details.aspx page you have to do this :
Request.QueryString["ID"]
这篇关于如何在新页面中使用querystring发送数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文