error: Only Content controls are allowed directly in a content page that contains Content controls.

Discussion in 'ASP .Net' started by hazz, Apr 26, 2006.

  1. hazz

    hazz Guest

    putting a custom control in an aspx page that inherits from a master page is
    not working out for me. Any tips after getting that error?
    Also Element 'Search' is not a known element. This can occur if there is a
    compilation error in the Web site.

    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
    AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Search"
    Title="Untitled Page" %>
    <%@ Register TagPrefix="uc" TagName="Search"
    Src="~\Controls\column_search_filter.ascx" %>

    <html>
    <body>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    Runat="Server">
    <uc:Search id="Search1"
    runat="server" />
    </asp:Content>
    </body>
    </html>


    Thank you,
    -Greg
     
    hazz, Apr 26, 2006
    #1
    1. Advertising

  2. Where are you seeing the error ? in the aspx page runtime or compiler error

    I am not sure if it is a problem, but might be worth change the Src to
    Src="~/Controls/column_search_filter.ascx" (/ instead of \)

    HTH

    --
    Swanand Mokashi
    Microsoft Certified Solution Developer (.NET) - Early Achiever
    Microsoft Certified Application Developer (.NET)

    http://www.dotnetgenerics.com/
    DotNetGenerics.com -- anything and everything about Microsoft .NET
    technology ...

    http://www.swanandmokashi.com/
    http://www.swanandmokashi.com/HomePage/WebServices/
    Home of the Stock Quotes, Quote of the day and Horoscope web services



    "hazz" <> wrote in message
    news:...
    > putting a custom control in an aspx page that inherits from a master page
    > is not working out for me. Any tips after getting that error?
    > Also Element 'Search' is not a known element. This can occur if there is a
    > compilation error in the Web site.
    >
    > <%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
    > AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Search"
    > Title="Untitled Page" %>
    > <%@ Register TagPrefix="uc" TagName="Search"
    > Src="~\Controls\column_search_filter.ascx" %>
    >
    > <html>
    > <body>
    > <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    > Runat="Server">
    > <uc:Search id="Search1"
    > runat="server" />
    > </asp:Content>
    > </body>
    > </html>
    >
    >
    > Thank you,
    > -Greg
    >
     
    Swanand Mokashi, Apr 26, 2006
    #2
    1. Advertising

  3. hazz

    hazz Guest

    Thank you Swanand.
    I will revisit that issue and see if that resolves it.
    -Greg

    "Swanand Mokashi" <> wrote in message
    news:...
    > Where are you seeing the error ? in the aspx page runtime or compiler
    > error
    >
    > I am not sure if it is a problem, but might be worth change the Src to
    > Src="~/Controls/column_search_filter.ascx" (/ instead of \)
    >
    > HTH
    >
    > --
    > Swanand Mokashi
    > Microsoft Certified Solution Developer (.NET) - Early Achiever
    > Microsoft Certified Application Developer (.NET)
    >
    > http://www.dotnetgenerics.com/
    > DotNetGenerics.com -- anything and everything about Microsoft .NET
    > technology ...
    >
    > http://www.swanandmokashi.com/
    > http://www.swanandmokashi.com/HomePage/WebServices/
    > Home of the Stock Quotes, Quote of the day and Horoscope web services
    >
    >
    >
    > "hazz" <> wrote in message
    > news:...
    >> putting a custom control in an aspx page that inherits from a master page
    >> is not working out for me. Any tips after getting that error?
    >> Also Element 'Search' is not a known element. This can occur if there is
    >> a compilation error in the Web site.
    >>
    >> <%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
    >> AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Search"
    >> Title="Untitled Page" %>
    >> <%@ Register TagPrefix="uc" TagName="Search"
    >> Src="~\Controls\column_search_filter.ascx" %>
    >>
    >> <html>
    >> <body>
    >> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    >> Runat="Server">
    >> <uc:Search id="Search1"
    >> runat="server" />
    >> </asp:Content>
    >> </body>
    >> </html>
    >>
    >>
    >> Thank you,
    >> -Greg
    >>

    >
    >
     
    hazz, Apr 27, 2006
    #3
  4. hazz

    engtg

    Joined:
    Jan 30, 2008
    Messages:
    1
    It may be late but will this work

    Try moving
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    Runat="Server"> above <html>
    Move </asp:Content> below </html>
    You may need to remove one of your Runat="Server"

    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
    AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Search"
    Title="Untitled Page" %>
    <%@ Register TagPrefix="uc" TagName="Search"
    Src="~\Controls\column_search_filter.ascx" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    Runat="Server">
    <html>
    <body>

    <uc:Search id="Search1" />

    </body>
    </html>
    </asp:Content>
     
    engtg, Jan 30, 2008
    #4
  5. hazz

    shai.wininger

    Joined:
    Mar 19, 2008
    Messages:
    1
    Solution is simple

    Hi,

    Just remove the "<!DOCTYPE html ..." line in the markup of the page. It is a duplication with the one in the master page.

    good luck !
     
    shai.wininger, Mar 19, 2008
    #5
  6. hazz

    leisenstein

    Joined:
    Dec 11, 2009
    Messages:
    1
    Fixed

    I was getting this error because I had 2 Content panels with the same ID.
     
    leisenstein, Dec 11, 2009
    #6
  7. hazz

    SkyUCHC

    Joined:
    Jun 9, 2010
    Messages:
    1
    If you pasted from tutorial

    If you cut and pasted from the NerdDinner tutorial, insert a space before the 1st runat="server" - it was left out. Once inserted, the error goes away.
     
    SkyUCHC, Jun 9, 2010
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Dyer
    Replies:
    5
    Views:
    688
  2. J.Edwards
    Replies:
    0
    Views:
    1,700
    J.Edwards
    Jan 20, 2006
  3. Replies:
    1
    Views:
    1,311
  4. Iñaki Baz Castillo
    Replies:
    13
    Views:
    553
    Iñaki Baz Castillo
    May 1, 2011
  5. Antoon Pardon
    Replies:
    5
    Views:
    96
    Andrew Cooper
    Apr 23, 2014
Loading...

Share This Page