conditionally show a master page?

  • Thread starter Thread starter WebBuilder451
  • Start date Start date
W

WebBuilder451

is there a way to turn off a master page under some conditions? I have a
master that has a master page. if a person is a member i wand to show the
second level master else i want to hise it. Is this possible?
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)

kes
 
WebBuilder451 said:
is there a way to turn off a master page under some conditions? I have a
master that has a master page. if a person is a member i wand to show the
second level master else i want to hise it. Is this possible?
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)

kes
If you mean turn it off programmatically then you may be able to set the
page's Master property to null in the PreInit event.
The trouble is that if you did this then all the content would be hidden so
I don't think it seems practical.
Perhaps just have a simple master with just bare content place holders and
swap this in when needed.
 
<%@ Page Language="C#" Title="Content Page" MasterPageFile="~/nonMember.master"%>
<%@ MasterType TypeName="BaseMaster" %>
<script runat="server">
protected void Page_PreInit(Object sender, EventArgs e)
{
this.MasterPageFile = "nonMember.master";
if(Request.QueryString["member"] == "true")
{
this.MasterPageFile = "Member.master";
}
this.Title = Master.MyTitle;
}
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
Content for Content page.
</asp:Content>




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
Back
Top