Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/476.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将querystring变量发送到新的弹出窗口_C#_Javascript_Asp.net - Fatal编程技术网

C# 将querystring变量发送到新的弹出窗口

C# 将querystring变量发送到新的弹出窗口,c#,javascript,asp.net,C#,Javascript,Asp.net,我的JavaScript代码如下: var newwindow; function poptastic(url) { newwindow = window.open(url, 'name', 'height=400,width=200'); if (window.focus) { newwindow.focus() } } 和我的C#代码: 我认为C代码有问题,因为当我在标记中使用此JavaScript代码时,它可以工作,但在属性中。添加不工作。尝试使用OnC

我的JavaScript代码如下:

var newwindow;
    function poptastic(url) {
     newwindow = window.open(url, 'name', 'height=400,width=200');
    if (window.focus) { newwindow.focus() }
    }
和我的C#代码:


我认为C代码有问题,因为当我在标记中使用此JavaScript代码时,它可以工作,但在
属性中。添加
不工作。

尝试使用
OnClientClick

btnReplay.OnClientClick = String.Format("poptastic(\"Configuration.aspx?id={0}\");return false;", e.CommandArgument);
编辑

以下是一个JavaScript函数,可用于打开弹出窗口:

openChildWindowWithDimensions = function(url, width, height, showMenu, canResize, showScrollbars) {
    var childWindow = window.open(url, "", "\"width=" + width + ",height=" + height + ",menubar=" + (showMenu ? "1" : "0") + ",scrollbars=" + (showScrollbars ? "1" : "0") + ",resizable=" + (canResize ? "1" : "0") + "\"");
    if (childWindow){
        childWindow.resizeTo(width, height);
        childWindow.focus();
    }
}

如果可以提供生成的HTML,这个问题将很容易回答。要查找生成的HTML,请在浏览器窗口中查看呈现的页面并查看源代码。看

根据您提供的代码,@jamesjohnson已经提出了我能提出的所有建议 请参阅对James代码的轻微更正
btnReplay.OnClientClick=String.Format(“poptastic('Configuration.aspx?id={0}”);返回false;”,e.CommandArgument)

注意:我变了\“到“

为什么标记了而没有?我想java脚本代码有问题..您能显示生成的HTML吗?不..”。。我看不见。。只是它在做后置手术和到底发生了什么完全不一样?它有什么作用吗?你有错误吗?为了安全起见,你可以在这里加一个分号:
newwindow.focus()@波斯语:“不工作”没有任何意义。见上面詹姆斯的评论。
openChildWindowWithDimensions = function(url, width, height, showMenu, canResize, showScrollbars) {
    var childWindow = window.open(url, "", "\"width=" + width + ",height=" + height + ",menubar=" + (showMenu ? "1" : "0") + ",scrollbars=" + (showScrollbars ? "1" : "0") + ",resizable=" + (canResize ? "1" : "0") + "\"");
    if (childWindow){
        childWindow.resizeTo(width, height);
        childWindow.focus();
    }
}