Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > error: Only Content controls are allowed directly in a content page that contains Content controls.

Reply
Thread Tools

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

 
 
hazz
Guest
Posts: n/a
 
      04-26-2006
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


 
Reply With Quote
 
 
 
 
Swanand Mokashi
Guest
Posts: n/a
 
      04-26-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
hazz
Guest
Posts: n/a
 
      04-27-2006
Thank you Swanand.
I will revisit that issue and see if that resolves it.
-Greg

"Swanand Mokashi" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
engtg engtg is offline
Junior Member
Join Date: Jan 2008
Posts: 1
 
      01-30-2008
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>
 
Reply With Quote
 
shai.wininger shai.wininger is offline
Junior Member
Join Date: Mar 2008
Posts: 1
 
      03-19-2008
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 !
 
Reply With Quote
 
leisenstein leisenstein is offline
Junior Member
Join Date: Dec 2009
Posts: 1
 
      12-11-2009
I was getting this error because I had 2 Content panels with the same ID.
 
Reply With Quote
 
SkyUCHC SkyUCHC is offline
Junior Member
Join Date: Jun 2010
Posts: 1
 
      06-09-2010
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why defining a constant in a method is not allowed but usingself.class.const_set is allowed? IƱaki Baz Castillo Ruby 13 05-01-2011 06:09 PM
Calling Master Page methods directly from Content Page inline code(.aspx file) DevNll2002@gmail.com ASP .Net 1 04-09-2008 12:51 AM
Error: "Content controls can only be used in a content page" J.Edwards ASP .Net 0 01-20-2006 11:43 AM
Regex problem, match if line contains <a>, unless it also contains <b> James Dyer Perl 5 02-20-2004 12:29 PM
Preview image directly on PC, save directly to HD Patrick M. Digital Photography 3 01-07-2004 08:29 PM



Advertisments