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

Discussion in 'ASP .Net' started by Nathan Sokalski, Dec 20, 2006.

  1. 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

    http://www.nathansokalski.com/
    Nathan Sokalski, Dec 20, 2006
    #1
    1. Advertising

  2. Nathan Sokalski

    Brock Allen Guest

    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.
    >
    Brock Allen, Dec 20, 2006
    #2
    1. Advertising

  3. 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

    http://www.nathansokalski.com/

    "Brock Allen" <> wrote in message
    news:...
    > 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.
    >>

    >
    >
    Nathan Sokalski, Dec 20, 2006
    #3
  4. 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" <> wrote in message
    news:%...
    > 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
    >
    > http://www.nathansokalski.com/
    >
    Juan T. Llibre, Dec 20, 2006
    #4
  5. 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

    http://www.nathansokalski.com/

    "Juan T. Llibre" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:%...
    >> 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
    >>
    >> http://www.nathansokalski.com/
    >>

    >
    >
    Nathan Sokalski, Dec 21, 2006
    #5
  6. 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><add> element.


    HTH

    --
    Happy Hacking,
    Gaurav Vaish | www.mastergaurav.com
    www.edujini-labs.com
    http://eduzine.edujinionline.com
    -----------------------------------------


    "Juan T. Llibre" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:%...
    >> 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
    >>
    >> http://www.nathansokalski.com/
    >>

    >
    >
    Gaurav Vaish \(www.Edujini-Labs.com\), Jan 10, 2007
    #6
    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. Replies:
    7
    Views:
    4,141
    Wilfred Knievel
    Mar 13, 2009
  2. CSharpner
    Replies:
    0
    Views:
    996
    CSharpner
    Apr 9, 2007
  3. Shan McArthur
    Replies:
    2
    Views:
    174
    Michael Baltic
    Jun 30, 2005
  4. Nathan Sokalski
    Replies:
    4
    Views:
    266
    Nathan Sokalski
    Dec 21, 2006
  5. Nathan Sokalski
    Replies:
    4
    Views:
    304
    Nathan Sokalski
    Dec 21, 2006
Loading...

Share This Page