How to pop up a window when useing Master Page

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.

posted on 2006-03-23 10:53  signaldance  阅读(466)  评论(0编辑  收藏  举报