window.open无法从代码隐藏文件开始工作 [英] window.open is not working from code behind file

查看:77
本文介绍了window.open无法从代码隐藏文件开始工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在C#ASP.NET 2.0中开发了一个页面。

我试图从我的代码后面的文件中打开一个新窗口。


我的代码如下所示
string pageName =" EntityDescription.aspx?Ecode =" +"''" + entityCode +"''" +"& EDesc = QUOT; +"''" + entityDesc +"''" ;;

String scriptString ="< script type =''text / javascript''>" ;

scriptString + =" window.onload = function(){window.open(''" + pageName +"'',''test'');}< / script> ;" ;;

ClientScript.RegisterClientScriptBlock(this.GetTyp e()," clientScript",scriptString);



它不是给出任何错误。但它没有为我打开新窗口。

有人可以帮我这个。

Hi,

I have one page developed in C# ASP.NET 2.0.
I am trying to open a new window from my code behind file.

My code is like below
string pageName = "EntityDescription.aspx?Ecode=" + "''" + entityCode + "''" + "& EDesc=" + "''" + entityDesc + "''";
String scriptString = "<script type=''text/javascript''>" ;
scriptString += "window.onload = function(){ window.open(''" + pageName + "'' ,''test'');}</script>";
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "clientScript", scriptString);


It is not giving any error.But it is not opening the new window for me.
Can someone help me on this.

推荐答案

那是javascript,应该在客户端执行。这个代码在哪里运行?
Well that is javascript, that should be executed client side. Where is this code being run?


是的,这是javascript。我实际上是在下拉列表中选择一些文本时尝试打开一个新窗口。

所以我已经把这个代码放在下拉列表中选择索引更改方法代码隐藏文件。


我在.net1.1中的prev项目中做了类似的事情。它工作正常。

但这里不是:(
Yes that is javascript.I am actually trying to open a new window when some text is selected in dropdown.
so i have put this code in dropdown selected index change method in code behind file.

I did something like this in my prev project in .net1.1.it was working fine.
but here it is not :(


.net1.1的控件上是否有.AddAttribute()函数?
Does .net1.1 have the .AddAttribute() function on it''s controls?


这篇关于window.open无法从代码隐藏文件开始工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆