473,395 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Using Web.config's <system.web><pages><controls><add /></controls></pages></system.web> To Register UserControls

My Web.config file contains the following section to register some of my
UserControls:

<pages>
<controls>
<add tagPrefix="NATE" tagName="Banner" src="~/Banner.ascx"/>
<add tagPrefix="NATE" tagName="Navigation" src="~/Navigation.ascx"/>
</controls>
</pages>

However, I still receive the following error:

Element 'Banner' is not a known element. This can occur if there is a
compilation error in the Web site.
Element 'Navigation' is not a known element. This can occur if there is a
compilation error in the Web site.

I have tried compiling, and this is the only error I receive. Is there
something I am forgetting to do? Is there something wrong with my Web.config
file? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Dec 20 '06 #1
5 2410
Put the ASCX files into a subdirectory and then try it.

-Brock
http://staff.develop.com/ballen

My Web.config file contains the following section to register some of
my UserControls:

<pages>
<controls>
<add tagPrefix="NATE" tagName="Banner" src="~/Banner.ascx"/>
<add tagPrefix="NATE" tagName="Navigation"
src="~/Navigation.ascx"/>
</controls>
</pages>
However, I still receive the following error:

Element 'Banner' is not a known element. This can occur if there is a
compilation error in the Web site.
Element 'Navigation' is not a known element. This can occur if there
is a
compilation error in the Web site.
I have tried compiling, and this is the only error I receive. Is there
something I am forgetting to do? Is there something wrong with my
Web.config file? Thanks.

Dec 20 '06 #2
Didn't help. I think that Visual Studio .NET 2005 is not realizing that I
have the controls registered in my Web.config file. Any other ideas?
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Brock Allen" <ba****@NOSPAMdevelop.comwrote in message
news:b8*************************@msnews.microsoft. com...
Put the ASCX files into a subdirectory and then try it.

-Brock
http://staff.develop.com/ballen

>My Web.config file contains the following section to register some of
my UserControls:

<pages>
<controls>
<add tagPrefix="NATE" tagName="Banner" src="~/Banner.ascx"/>
<add tagPrefix="NATE" tagName="Navigation"
src="~/Navigation.ascx"/>
</controls>
</pages>
However, I still receive the following error:

Element 'Banner' is not a known element. This can occur if there is a
compilation error in the Web site.
Element 'Navigation' is not a known element. This can occur if there
is a
compilation error in the Web site.
I have tried compiling, and this is the only error I receive. Is there
something I am forgetting to do? Is there something wrong with my
Web.config file? Thanks.


Dec 20 '06 #3
Nathan,

I don't see "src" documented anywhere.
I do see "source" documented, however.

Could you check to see if this works :

<add
tagprefix="NATE"
tagname="Banner"
source="Banner.ascx"/>

<add
tagprefix="NATE"
tagname="Navigation"
source="Navigation.ascx"/>

?

....and let us know if it works.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
My Web.config file contains the following section to register some of my UserControls:

<pages>
<controls>
<add tagPrefix="NATE" tagName="Banner" src="~/Banner.ascx"/>
<add tagPrefix="NATE" tagName="Navigation" src="~/Navigation.ascx"/>
</controls>
</pages>

However, I still receive the following error:

Element 'Banner' is not a known element. This can occur if there is a compilation error in the Web
site.
Element 'Navigation' is not a known element. This can occur if there is a compilation error in the
Web site.

I have tried compiling, and this is the only error I receive. Is there something I am forgetting
to do? Is there something wrong with my Web.config file? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Dec 20 '06 #4
I am not sure what documentation you are looking at, but if you go to:

ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/dv_ASPNETgenref/html/852861eb-dba7-41eb-9c34-fa09b99abac0.htm

It contains the following documentation under the Attributes section:
src
Optional String attribute.

Specifies the name of the file that contains the user control and
requires that the tagName attribute is also set.


Also, when I tried changing it from src to source the error specified that
'source' was an unrecognized attribute. Any other ideas?
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:ew**************@TK2MSFTNGP04.phx.gbl...
Nathan,

I don't see "src" documented anywhere.
I do see "source" documented, however.

Could you check to see if this works :

<add
tagprefix="NATE"
tagname="Banner"
source="Banner.ascx"/>

<add
tagprefix="NATE"
tagname="Navigation"
source="Navigation.ascx"/>

?

...and let us know if it works.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>My Web.config file contains the following section to register some of my
UserControls:

<pages>
<controls>
<add tagPrefix="NATE" tagName="Banner" src="~/Banner.ascx"/>
<add tagPrefix="NATE" tagName="Navigation" src="~/Navigation.ascx"/>
</controls>
</pages>

However, I still receive the following error:

Element 'Banner' is not a known element. This can occur if there is a
compilation error in the Web site.
Element 'Navigation' is not a known element. This can occur if there is a
compilation error in the Web site.

I have tried compiling, and this is the only error I receive. Is there
something I am forgetting to do? Is there something wrong with my
Web.config file? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/


Dec 21 '06 #5
If the ascx and aspx are in the same directory, you will get an error
stating that the control could not be loaded:

"because it is registered in web.config and lives in the same directory as
the page"

Make a directory, say, UControls and then do the following:

<add tagPrefix='nate' tagName='Banner' src='~/UControls/Banner.ascx' />

btw, there's no 'source' attribute. There's only 'src' attribute in
<controls><addelement.
HTH

--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujinionline.com
-----------------------------------------
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:ew**************@TK2MSFTNGP04.phx.gbl...
Nathan,

I don't see "src" documented anywhere.
I do see "source" documented, however.

Could you check to see if this works :

<add
tagprefix="NATE"
tagname="Banner"
source="Banner.ascx"/>

<add
tagprefix="NATE"
tagname="Navigation"
source="Navigation.ascx"/>

?

...and let us know if it works.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>My Web.config file contains the following section to register some of my
UserControls:

<pages>
<controls>
<add tagPrefix="NATE" tagName="Banner" src="~/Banner.ascx"/>
<add tagPrefix="NATE" tagName="Navigation" src="~/Navigation.ascx"/>
</controls>
</pages>

However, I still receive the following error:

Element 'Banner' is not a known element. This can occur if there is a
compilation error in the Web site.
Element 'Navigation' is not a known element. This can occur if there is a
compilation error in the Web site.

I have tried compiling, and this is the only error I receive. Is there
something I am forgetting to do? Is there something wrong with my
Web.config file? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/


Jan 10 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Ian Rastall | last post by:
I'm curious as to the group's feelings about using the <fieldset> and <legend> tags around elements other than <form> elements ... I wrote a small test file:...
7
by: Brad | last post by:
I'm placing a runat=server attribute on the <title> tag in my pages, so I can read/set the title text in code. The problem is that when I subsequently change the page in design view VS is...
8
by: Mark | last post by:
We have a multi-line textbox that users copy and paste email text into. The pasted text frequently will contain a tag like <blah@aol.com> or similar. I believe .NET is protecting itself from code...
2
by: Don Wash | last post by:
Hi There! I'm creating my website with ASP.NET + XHTML, which means I will strictly adhere the XHTML standards for my web page output. I use Panel or PlaceHolder WebControls to place...
2
by: Axel Dahmen | last post by:
HI, I want to dynamically add controls to a web page from within a common base class. Unfortunately, ASP.NET fails with "System.Web.HttpException: The Controls collection cannot be modified...
29
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form...
4
by: serge calderara | last post by:
Dear all, I have read that instead of registering an assembly on the top a a page with the Register directive we can use the <assembliea> section of Web config file as follow : <assemblies>...
4
by: Alex Maghen | last post by:
I have a master page which contains a general page framework and also contains a <form runat=server> around most of the content of the page. Inside that <form> tag is a ContentPlaceholder. I...
5
by: Nathan Sokalski | last post by:
My Web.config file contains the following section to register some of my UserControls: <pages> <controls> <add tagPrefix="NATE" tagName="Banner" src="~/Banner.ascx"/> <add tagPrefix="NATE"...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.