框架页面代码:Room.aspx<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<frameset rows="52,*,200" frameborder="no" border="0" framespacing="0">
  <frame src="head.aspx" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
  <frame src="main.aspx" name="mainFrame" id="mainFrame" title="mainFrame" />
  <frame src="foot.aspx" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame" title="bottomFrame" />
</frameset>
<noframes><body>
</body></noframes>
</html>
另一个页面跳转到Room.aspx页面时带有参数,Room.aspx?id=1;那么框架内的页面如何获得id=1?

解决方案 »

  1.   

    string id = Request["id"].ToString()
      

  2.   

    string id=Request.QueryString["id"].ToString();
      

  3.   

    <frame src="head.aspx?id=<%=Request.QueryString["id"]%>"
      

  4.   

    <frame src="main.aspx?id=<%=Request.QueryString["id"]==null?"":Request.QueryString["id"]%>" name="mainFrame" id="mainFrame" title="mainFrame" />
      

  5.   

    因为你是GET传值,所以用上面各位所说的,如果是后台的也可用Session
      

  6.   

    <frame src="main.aspx?id=<%=Request.QueryString["id"]==null?"":Request.QueryString["id"]%>" name="mainFrame" id="mainFrame" title="mainFrame" />
      

  7.   

    <frame src="main.aspx?id=<%=id%>" name="mainFrame" id="mainFrame" title="mainFrame" />
    public string id
    {
     get{return Request.QueryString["id"]==null?"":Request.QueryString["id"].ToString();}
    }
      

  8.   

    楼上已经说的很清楚 了,用 Request.QueryString["id"]取值
      

  9.   

    string id = Request.QueryString["id"];
    topFrame.Attributes["src"] = "head.aspx?id="+id;