Mike Jonson

Mike Jonson

  • NA
  • 239
  • 193.5k

Error Only Content controls are allowed directly in a content page that contains Content controls

Jul 22 2011 4:12 AM
Hello, people

Show this error. But why? I learn now asp.net, not all undestand

have this error in page default.aspx

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" 
CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1"
    ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>

<!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></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    </form>
</body>
</html>

and have page masterpage.master

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="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></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
       
        </asp:ContentPlaceHolder>
    </div>
    <h1>
        <asp:Label ID="lbl_main" runat="server" Text="Welcome to Cars US"></asp:Label>
&nbsp;
        <asp:AdRotator ID="myAdRotator" runat="server" AdvertisementFile="~/Ads.xml" />
    </h1>
    <p>
        &nbsp;</p>
    <p>
        &nbsp;</p>
    <p>
        <asp:Menu ID="Menu1" runat="server">
            <Items>
                <asp:MenuItem NavigateUrl="Default.aspx" Text="Home" Value="Home">
                </asp:MenuItem>
                <asp:MenuItem NavigateUrl="BuildCar.aspx" Text="Buil a car" Value="Buil a car">
                </asp:MenuItem>
                <asp:MenuItem NavigateUrl="Inventory.aspx" Text="View inventory"
                    Value="View inventory"></asp:MenuItem>
            </Items>
        </asp:Menu>
    </p>
    </form>
    <p>
        &nbsp;</p>
</body>
</html>

Please help

Answers (6)