公用类处理 跳转到指定页面并且 传递两个参数?

zhouxh519 2009-11-20 02:52:29
我需要在一个 公用的类文件里 执行跳转到 某指定页面,并传递两个参数,有什么好的 实现方法吗?最好 是让跳转的页面能够全屏显示。
...全文
178 23 打赏 收藏 转发到动态 举报
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhouxh519 2009-11-25
  • 打赏
  • 举报
回复
结贴了,谢谢各位大侠了。
mohugomohu 2009-11-23
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 watsonchia 的回复:]
引入System.Web命名空间,然后可以用HttpContext.Current取得当前上下文。
HttpContext.Current.Response.Redirect("a.aspx");
[/Quote]1
zhouxh519 2009-11-23
  • 打赏
  • 举报
回复
还有大侠在吗?
zhouxh519 2009-11-20
  • 打赏
  • 举报
回复
[Quote=引用 18 楼 watsonchia 的回复:]
引用 12 楼 zhouxh519 的回复:
引用 11 楼 watsonchia 的回复:
昏了。。。
引入System.Web命名空间,然后可以用HttpContext.Current取得当前上下文。
HttpContext.Current.Response.Redirect("a.aspx");


  就是这个不执行啊


引用了System.Web的空间,加上using System.Web,我这里测试可以执行。
[/Quote]
在我这边没反应,在某个页面的后台执行还行,但在一个单独类中他不执行,我晕
zuoming120 2009-11-20
  • 打赏
  • 举报
回复
public static string MessageBoxs(string TxtMessage, string Url)
{
string str;
str = "<script type='text/javascript'>alert('" + TxtMessage + "');location='" + Url + "'</script>";
return str;
}
watsonchia 2009-11-20
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 zhouxh519 的回复:]
引用 11 楼 watsonchia 的回复:
昏了。。。
引入System.Web命名空间,然后可以用HttpContext.Current取得当前上下文。
HttpContext.Current.Response.Redirect("a.aspx");


  就是这个不执行啊

[/Quote]
引用了System.Web的空间,加上using System.Web,我这里测试可以执行。
slove1116 2009-11-20
  • 打赏
  • 举报
回复
用个委托可以么?

委托时间在页面写好要跳转的方法!在类中指定委托!(也不知道叫不叫委托)

Vb

Public Event Finished(ByVal retType As ReturnType)

Public sub TransformFile()
''''你的代码
'''你要跳转的地方
RaiseEvent Finished(retVal)
End Sub
'你的页面new 你的类
Private WithEvents routines As New EncryptionRoutines
'你的页面完成这方法
Private Sub routines_Finished(ByVal retType As EncryptionRoutines.ReturnType) Handles routines.Finished
response.Redirect("a.aspx")
End sub


zhouxh519 2009-11-20
  • 打赏
  • 举报
回复
再顶下
zhouxh519 2009-11-20
  • 打赏
  • 举报
回复
顶顶啊
zhouxh519 2009-11-20
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 cqdyh 的回复:]
JScript codevar p_EBV=null;function openfull(url, param)
{if( window.navigator.appName=="Microsoft Internet Explorer"&& window.navigator.appVersion.substring(
window.navigator.appVersion.indexOf("MSIE")+5,
window.navigator.appVersion.indexOf("MSIE")+8)>=6.0 )
{var featureStr='fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,left=0,top=0,width='+ (window.screen.width-10)+',height='+ (window.screen.height-44);
p_EBV= window.open( url,'_WebBookView', featureStr );
}else
{
document.location= url;
}
}

------
imgBCover.Attributes["onclick"] = "openfull('bookview.aspx');return false;";
[/Quote]


我需要在一个 公用的C#类里写啊,没用js
  • 打赏
  • 举报
回复
学习
zhouxh519 2009-11-20
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 watsonchia 的回复:]
昏了。。。
引入System.Web命名空间,然后可以用HttpContext.Current取得当前上下文。
HttpContext.Current.Response.Redirect("a.aspx");
[/Quote]

就是这个不执行啊
watsonchia 2009-11-20
  • 打赏
  • 举报
回复
昏了。。。
引入System.Web命名空间,然后可以用HttpContext.Current取得当前上下文。
HttpContext.Current.Response.Redirect("a.aspx");
cqdyh 2009-11-20
  • 打赏
  • 举报
回复
var p_EBV=null;
function openfull(url, param)
{
if( window.navigator.appName=="Microsoft Internet Explorer"
&& window.navigator.appVersion.substring(
window.navigator.appVersion.indexOf("MSIE")+5,
window.navigator.appVersion.indexOf("MSIE")+8) >= 6.0 )
{
var featureStr = 'fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,left=0,top=0,width='+ (window.screen.width-10) +',height='+ (window.screen.height-44);
p_EBV = window.open( url, '_WebBookView', featureStr );
}
else
{
document.location = url;
}
}


------
imgBCover.Attributes["onclick"] = "openfull('bookview.aspx');return false;";
zhouxh519 2009-11-20
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 watsonchia 的回复:]
公用类库不能取得当前context,看来只好response.write(window.open("a.aspx"))这样了 - -
[/Quote]

这个我执行了不能用
watsonchia 2009-11-20
  • 打赏
  • 举报
回复
window.open("a.aspx?para1=1¶2=2")
watsonchia 2009-11-20
  • 打赏
  • 举报
回复
公用类库不能取得当前context,看来只好response.write(window.open("a.aspx"))这样了 - -
slove1116 2009-11-20
  • 打赏
  • 举报
回复
給类加个url属性!new的时候加进去!
zhouxh519 2009-11-20
  • 打赏
  • 举报
回复
再 顶下
zhouxh519 2009-11-20
  • 打赏
  • 举报
回复
不用全屏只要在最上层显示 就行了 比如top.location.href ="a.aspx" ,但是先在我这个是要写在某个公用类里,不是某个页面的后台,因而不能执行上面的,而且参数也不知道怎么传递?
加载更多回复(3)

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧