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

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default 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
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]


    Nathan Sokalski Guest

  2. Similar Questions and Discussions

    1. .net user controls ascx pages
      hi, need to know if contribute can allow our non-technical users to edit the user controls that contain the information they are about to be...
    2. Editing ASPX pages with controls
      Are there currently any workarounds or fixes for the editing of ASP (.aspx) pages that contain customer user controls (.ascx)? Viewing the site...
    3. using TagPrefix to avoid having @ Register directives on pages using custom controls
      Hello, I am designing a custom control in a seperate DLL. I have used the assembly:TagPrefix attribute in this project. The project is included...
    4. Enumerating Controls Collection in Control.Render() causes System.InvalidOperationException - Why???
      Hi all! any ideas why this code... protected override void Render(HtmlTextWriter writer) { Table table; TableRow row; TableCell cell; ...
    5. The lifecycle of ASP.NET pages and custom controls
      Reading this at the moment http://www.pcquest.com/content/coding/103050501.asp "Billy Porter" <billy@xymox.com> wrote in message...
  3. #2

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

    Put the ASCX files into a subdirectory and then try it.

    -Brock
    [url]http://staff.develop.com/ballen[/url]

    > 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 Guest

  4. #3

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

    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
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]

    "Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message
    news:b8743b11d4878c8f1e892ba616e@msnews.microsoft. com...
    > Put the ASCX files into a subdirectory and then try it.
    >
    > -Brock
    > [url]http://staff.develop.com/ballen[/url]
    >
    >
    >> 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 Guest

  5. #4

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

    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 : [url]http://asp.net.do/faq/[/url]
    foros de asp.net, en español : [url]http://asp.net.do/foros/[/url]
    ===================================
    "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
    news:%23X7fgr9IHHA.1248@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
    > [email]njsokalski@hotmail.com[/email]
    > [url]http://www.nathansokalski.com/[/url]
    >

    Juan T. Llibre Guest

  6. #5

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

    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
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]

    "Juan T. Llibre" <nomailreplies@nowhere.com> wrote in message
    news:ewAxGhHJHHA.4992@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 : [url]http://asp.net.do/faq/[/url]
    > foros de asp.net, en español : [url]http://asp.net.do/foros/[/url]
    > ===================================
    > "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
    > news:%23X7fgr9IHHA.1248@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
    >> [email]njsokalski@hotmail.com[/email]
    >> [url]http://www.nathansokalski.com/[/url]
    >>
    >
    >

    Nathan Sokalski Guest

  7. #6

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

    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 | [url]www.mastergaurav.com[/url]
    [url]www.edujini-labs.com[/url]
    [url]http://eduzine.edujinionline.com[/url]
    -----------------------------------------


    "Juan T. Llibre" <nomailreplies@nowhere.com> wrote in message
    news:ewAxGhHJHHA.4992@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 : [url]http://asp.net.do/faq/[/url]
    > foros de asp.net, en español : [url]http://asp.net.do/foros/[/url]
    > ===================================
    > "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
    > news:%23X7fgr9IHHA.1248@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
    >> [email]njsokalski@hotmail.com[/email]
    >> [url]http://www.nathansokalski.com/[/url]
    >>
    >
    >

    Gaurav Vaish \(www.Edujini-Labs.com\) Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139