日期:2014-05-18 浏览次数:20640 次
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);
}
}
}
------解决方案--------------------
别用selectedNodeChanged事件
treeNode.NavigateUrl="TopicList.aspx?Department=1"
treeNode.Target = "ContentFrame"