admin管理员组文章数量:1356152
I have several aspx pages that can be opened either normally (full screen in browser), or called from another page as a popup (I am using Greybox, fwiw)
If the page is opened as a popup in Greybox, I would like to NOT display the master page content (which displays mon top and left menus, etc).
As far as I know, there is no way of knowing server side if the page is a popup, this must be detected in client side javascript (in the case of Greybox, by checking window.parent.parent), and therefore the master page content must be hidden via javascript as well.
Any ideas on how to approach this?
I have several aspx pages that can be opened either normally (full screen in browser), or called from another page as a popup (I am using Greybox, fwiw)
If the page is opened as a popup in Greybox, I would like to NOT display the master page content (which displays mon top and left menus, etc).
As far as I know, there is no way of knowing server side if the page is a popup, this must be detected in client side javascript (in the case of Greybox, by checking window.parent.parent), and therefore the master page content must be hidden via javascript as well.
Any ideas on how to approach this?
Share Improve this question asked Nov 18, 2008 at 17:11 tbonetbone 5,86522 gold badges93 silver badges140 bronze badges3 Answers
Reset to default 9Create a simplified master page for the popup. Override the OnPreInit method (of the actual page) and switch out the masterpage based on a querystring argument:
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
if(Request["PopUp"] == "Y")
{
MasterPageFile = "~/MyPopUp.master";
}
}
Well you could conditionally render the navigation controls etc. based on a querystring, pass the string in when it's a popup and if it exists don't render the controls. There are a few different ways to do it, but I think you should have the server not render the controls rather than client side hiding them.
P.S. Haven't heard of Greybox so I can't offer any specific insight there.
I agree. This is a server-side problem, not something to scrape into shape on the client side. It may also be valuable to organize your web pages where the mon content between the pop-up and a main page is maintained separately and imported server-side into the page that has the master-page surround. Pages that link pop-ups should use the ment content, not the surrounder.
Lots of ways to do this (but I don't suppose anyone wants to know how FrontPage extensions help). Try server-side includes.
本文标签:
版权声明:本文标题:javascript - Is it possible to hide the content of an asp.net master page, if page is opened as a popup? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744003569a2574297.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论