我有的是点击打开的一个模式窗口,状态栏显示:http://localhost/scm/productin.aspx?id=18
我在页面load时用一个label获致URI却显示为空?
Label1.Text=Request.QueryString[ "id "].ToString();
发现这个Label1.Text为空?如何解决啊?谢谢!
------解决方案--------------------------------------------------------
模式窗口是一种方便的当前页面扩展的方式,但是aspx文件只能作为HTM文件的IFRAME才能用这种方式调用。同时,请求字符串也是一种方便常用的页面间传值的方法,那么怎么样使两者给合起来,就是实现如何用请求字符串传值给用模式窗口打开的aspx页面呢?
我们可以用JS脚本实现这种功能:
1.调用页面代码:
<script language= "javascript ">
function GetCorrelativeItemId()
{
rdl = document.getElementsByName( "rdlSystem ");
input = document.getElementById( "txtCorrelativeItem ");
sysid = " ";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT ")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog( "SearchItemC.htm?sysid= "+sysid,window, "resizable:1; ");
if(arg!=null)
{
input.value = arg;
}
}
</script>
2.打开的HTM文件的代码(SearchItemC.htm):
<HTML>
<HEAD>
<script language= "javascript ">
function ResolveUrl()
{
var frm = window.frames[0];
frm.location = location.toString().replace( "C.htm ", "C.aspx ");
}
</script>
</HEAD>
<BODY style= "margintop:0;marginleft:0;marginright:0;marginbottom:0 " onload= "ResolveUrl() ">
<table align= "left " cellpadding= "0 " cellspacing= "0 " width= "100% " height= "100% " ID= "Table1 ">
<tr>
<td valign= "top " width= "100% " height= "100% "> <iframe id= "ifmain " border= "0 " width= "100% " height= "100% "> </iframe> </td>
</tr>
</table>
</BODY>
</HTML>
3.Aspx文件(SearchItemC.aspx)代码:
Request.QueryString[ "sysid "].Trim();
转贴自:http://www.xker.com/page/e2007/0118/18899
------解决方案--------------------------------------------------------
Request[ "id "]
用这个试试。我也有这样的情况,有时候改一下就可以了!!!!
呵呵~!