vs2008 asp.net Treeview 如何点击结点将网页载入指定框架 本帖最后由 thinclient 于 2012-04-14 07:44:41 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考:http://blog.csdn.net/taomanman/article/details/5712959 你需要在点击事件跳转页面的同时,指定Target为ContentFrame你可以新建一个类using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;/// <summary>///ResponseHelper 的摘要说明/// </summary>public static class ResponseHelper{ public static void Redirect(string url, string target, string windowFeatures) { HttpContext context = HttpContext.Current; if ((String.IsNullOrEmpty(target) || target.Equals("_self", StringComparison.OrdinalIgnoreCase)) && String.IsNullOrEmpty(windowFeatures)) { context.Response.Redirect(url); } else { Page page = (Page)context.Handler; if (page == null) { throw new InvalidOperationException("Cannot redirect to new window outside Page context."); } url = page.ResolveClientUrl(url); string script; if (!String.IsNullOrEmpty(windowFeatures)) { script = @"<script>window.open(""{0}"", ""{1}"", ""{2}"");</script>"; } else { script = @"<script>window.open(""{0}"", ""{1}"");</script>"; } script = String.Format(script, url, target, windowFeatures); page.RegisterStartupScript("", script); } }}然后<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"/></frameset></html> protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e){ string url = "TopicList.aspx?Department="+TreeView1.SelectedNode.ValuePath; ResponseHelper.Redirect(url,"ContentFrame", ""); } vs中用的是iframe吧 frameset 这个在vs中不能用的吧 别用selectedNodeChanged事件treeNode.NavigateUrl="TopicList.aspx?Department=1"treeNode.Target = "ContentFrame" 你的回复解决了三帖没解决的问题:请到以下帖中回复加分好么http://topic.csdn.net/u/20120414/07/19da314a-25e5-4122-8762-816b1d244c7c.htmlhttp://topic.csdn.net/u/20120414/09/2a8c9765-47eb-4b5e-8220-a1e17c860a4e.htmlhttp://topic.csdn.net/u/20120414/11/b25a4b5f-906f-481b-a081-54895a6ae108.html 还有这个帖子也是:http://topic.csdn.net/u/20120413/21/8ee7c712-799c-46a0-b069-9305c59e3dee.html?seed=748636969&r=78245209#r_78245209 页面刷新问题 请教一个问题,怎么判断dropdownlist有没有值? 在.Net2.0中使用梅花雨日历控件疑问,急~~~~~~~~ 请哪位大哥写一下原代码 怎么把按扭绑定在DataGrid1的后面 帮忙找个错误,谢谢。。 怎么建框架页? 顶者有分!讨论进销存软件! 请教高手:全部分奉上!!!!! 高分相求:如何将两个DataSet 的数据合并,并更新到一个数据库中;谢谢,比较着急 大家用VS2010有没有这样一个bug? my97datepicker 传参问题
http://blog.csdn.net/taomanman/article/details/5712959
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;/// <summary>
///ResponseHelper 的摘要说明
/// </summary>
public static class ResponseHelper
{
public static void Redirect(string url, string target, string windowFeatures)
{
HttpContext context = HttpContext.Current;
if ((String.IsNullOrEmpty(target) || target.Equals("_self", StringComparison.OrdinalIgnoreCase)) && String.IsNullOrEmpty(windowFeatures))
{
context.Response.Redirect(url);
}
else
{
Page page = (Page)context.Handler;
if (page == null)
{
throw new InvalidOperationException("Cannot redirect to new window outside Page context.");
}
url = page.ResolveClientUrl(url);
string script;
if (!String.IsNullOrEmpty(windowFeatures))
{
script = @"<script>window.open(""{0}"", ""{1}"", ""{2}"");</script>";
}
else
{
script = @"<script>window.open(""{0}"", ""{1}"");</script>";
}
script = String.Format(script, url, target, windowFeatures);
page.RegisterStartupScript("", script);
}
}
}然后<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"/>
</frameset>
</html> protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
string url = "TopicList.aspx?Department="+TreeView1.SelectedNode.ValuePath;
ResponseHelper.Redirect(url,"ContentFrame", "");
}
treeNode.NavigateUrl="TopicList.aspx?Department=1"
treeNode.Target = "ContentFrame"
请到以下帖中回复加分好么
http://topic.csdn.net/u/20120414/07/19da314a-25e5-4122-8762-816b1d244c7c.html
http://topic.csdn.net/u/20120414/09/2a8c9765-47eb-4b5e-8220-a1e17c860a4e.html
http://topic.csdn.net/u/20120414/11/b25a4b5f-906f-481b-a081-54895a6ae108.html
http://topic.csdn.net/u/20120413/21/8ee7c712-799c-46a0-b069-9305c59e3dee.html?seed=748636969&r=78245209#r_78245209