2015-05-04 64 views
0

我想从模态弹出窗口创建一个新的ID,然后关闭radwindow并使用刚刚创建的ID重定向到一个页面。我试图让这个工作很困难,有人可以看一看,看看他们是否知道我做错了什么?我花了数小时在Google上寻找解决方案,但没有发现对我有任何帮助。传递ID通过javascript函数调用asp.net

//this happens when the save button inside the radwindow gets clicked 
    var pid = post.ID; 
    this.AddClientScript("CloseAndRedirect(pid)"); // pass the parent ID into the javascript function 

//this function is in the Window.Master file where all radwindow functions are kept 

function CloseAndRedirect(pid) { 
     GetRadWindow().BrowserWindow.location.href = ("/Blog/Post-Maintenance.aspx?id=" + pid); 
     GetRadWindow().Close(); 
    } 

我只需要能够添加pid的javascript函数调用,因此它可以是变量传递给打开了新的一页。使用这段代码,我最终会在URL的末尾添加一个?id = pid的页面。我不是最好的JavaScript,但我试图在变量周围添加“'和”“,只是得到一个语法错误。

预先感谢您不要判断我的abilites。 :)

回答

1
this.AddClientScript("CloseAndRedirect("+pid+")"); 

我想你应该这样调用序得到它的工作

+0

完美!谢谢!我会在几分钟内接受这个答案,它不会让我这样做。 :) – jlg

+0

谢谢jlg。很高兴这有帮助。快乐编码:) –