2015-05-04 63 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。很高興這有幫助。快樂編碼:) –