Hi,
Base on your description, you want the content page to remove the master page at runtime,that is to as say, do not use the master page at runtime, right?
But if the content page used the master page, the aspx file will like this:
<%@ Page Language="C#" MasterPageFile="~/TestCases/DEFAULT.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="TestCases_Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server">
</asp:Content>
So it is very different with the normall page, so the content page only can work fine with the master page, or else it will throw the error message.
About how the master page and the content page work, you can read this article: http://www.odetocode.com/Articles/450.aspx
But you can try to implement it by using the flexible method.
For exampe:
You can create a empty master page, there is nothing other than the contentplaceholder control and the html tags. So if the content page use this master page, the page only display itself. At the runtime. change the content page's masterpagefile in the PreInit event programmatically.
If you do like this, will not disturb the other existed pages.
for example:
1. the empty master page:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="TestCases_MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>
2. Set the content page's masterpagefile programatically
void BasePage_PreInit(object sender, EventArgs e)
{
MasterPageFile = "~/MasterPage.master";
}
Hope it helps.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Yours sincerely,
Amanda Wang
Microsoft Online Community Support