How to pop up a window when useing Master Page

it2022-05-09  34

Usually, when you pop up a window to show info from the father page, you use sth like:

control.Value= Request.QueryString["textbox"].ToString();...string strscript = "<script>window.opener.document.getElementById('" + control.Value + "').value='xxx'"+ "</" + "script>";...Through window.opener.document.getElementById(), you can access controls in the father page.But when using Master Page which appears in ASP.NET 2.0, the codes above will no longer work, because a new page's content consists both info from the Master page and new add-ons. To access controls from the combined page in the pop up window, however, you can use a hierarchical path as follows:control.Value = "ctl00$ContentPlaceHolder1$"+Request.QueryString["textbox"].ToString();replace '$' with '_' will also work: control.Value = "ctl00_ContentPlaceHolder1_"+Request.QueryString["textbox"].ToString();You can trace this result in debug environment.

转载于:https://www.cnblogs.com/signaldance/archive/2006/03/23/356524.html


最新回复(0)