日期:2014-05-18  浏览次数:20490 次

如何让网页显示在指定的Frame中?
下面的C#代码如何修改,才能让TopicList.aspx显示在ContentFrame中?

  protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
  {
  Response.Write(TreeView1.SelectedNode.ValuePath );

  Response.Redirect("TopicList.aspx?Department="+TreeView1.SelectedNode.ValuePath);

  }

我的Frameset如下:
<html>
<frameset id="sidebar_content" cols="225, *" frameborder="1" border="6" framespacing="5" bordercolor="#A1C7F9">
  <frame name="NavigetionFrame" src="tree.aspx" frameborder="1" />
  <frame name="ContentFrame" src="TopicList.aspx">../test/CKEditor.aspx" frameborder="0" />
</frameset>
</html>

------解决方案--------------------
方法1
Response.Write("<script>window.top.frames['ContentFrame'].location='TopicList.aspx?Department="+TreeView1.SelectedNode.ValuePath + "'");</script>;

方法2,
protected void Page_Load(object sender, EventArgs e) { 
Page.Form.Target='ContentFrame'"); 
}