0
我正面臨着返回父頁面的問題。 請幫助。如何從window.ShowModelDialog中將值返回給父頁面?
我有一個gridview允許用戶在該行添加新記錄,但用戶也可以點擊該行上的搜索按鈕,我將彈出下面的代碼。
TextBox txtCarNo = gvLookup.FooterRow.FindControl("txtNo") as TextBox;
System.Text.StringBuilder s = new System.Text.StringBuilder();
s.Append("<script language='javascript' id='SearchResult'> ");
s.Append("var WinSettings = 'dialogHeight:400px ; dialogWidth: 550px ;center: Yes ;resizable: No;status: no'; ");
s.Append("javascript: window.showModalDialog('Search.aspx?no=" + txtNo.Text.Trim().ToUpper() + "','',WinSettings); ");
s.Append("</script > ");
if ((!ClientScript.IsStartupScriptRegistered("SearchResult")))
{
ClientScript.RegisterStartupScript(this.GetType(), "SearchResult", s.ToString());
}
在子頁面,就會有另一個GridView控件,顯示搜索結果,用戶可以在該行的一個點擊返回數字回父頁面。 我想過使用Session來傳遞值,但是當顯示ShowModalDialog時,父頁面上的代碼已經通過,這意味着Session不能在這種情況下工作。
請指教我如何返回一個值到父頁面。 非常感謝。
嗨丹尼,非常感謝您的幫助。我應該在哪裏把警報放在主窗口中? – EngLoon
如果您需要警報,則應該在showModalDialog()命令之後執行。 – Ted
嗨丹尼。實際上,在用戶從ShowModalDialog中選擇一個數字後,我需要在主頁面的gridview中將選定的數字顯示到頁腳行中。我面臨的問題是我不知道如何將選定的編號分配到頁腳行中。 :) – EngLoon