conditionally show a master page?

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
 
J

Joe Fawcett

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.
 
J

Juan T. Llibre

<%@ 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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top