asp.net - Registering user controls in cascading web.config files -
asp.net - Registering user controls in cascading web.config files -
i have web.config file in root folder of asp.net web application registers user controls in project.
~/web.config
~/controls/myreusablecontrol.ascx
~/non/reusable/controls/anothercontrol.ascx
~/non/reusable/even/more/specific/controls/mythirdcontrol.ascx
<system.web> <pages> <controls> <add tagprefix="uc" tagname="myreusablecontrol" src="~/controls/myreusablecontrol.ascx" /> <add tagprefix="uc" tagname="anothercontrol" src="~/non/reusable/controls/anothercontrol.ascx" /> <add tagprefix="uc" tagname="mythirdcontrol" src="~/non/reusable/even/more/specific/controls/mythirdcontrol.ascx" /> </controls> </pages> </system.web> registering every command in root web.config file seems bad idea. of controls designed single page or grouping of related pages.
i'd register non-reusable controls in web.config file logically closer page controls used.
~/controls/mycontrol.ascx
~/web.config
<system.web> <pages> <controls> <add tagprefix="uc" tagname="myreusablecontrol" src="~/controls/myreusablecontrol.ascx" /> </controls> </pages> </system.web> ~/non/reusable/controls/anothercontrol.ascx
~/non/reusable/web.config
<system.web> <pages> <controls> <add tagprefix="uc" tagname="anothercontrol" src="~/non/reusable/controls/anothercontrol.ascx" /> </controls> </pages> </system.web> ~/non/reusable/even/more/specific/controls/mythirdcontrol.ascx
~/non/reusable/even/more/specific/web.config
<system.web> <pages> <controls> <add tagprefix="uc" tagname="mythirdcontrol" src="~/non/reusable/even/more/specific/controls/mythirdcontrol.ascx" /> </controls> </pages> </system.web> am allowed that? tried moving relevant parts of configuration new web.config files, seems break web forms designer pages reference non-reusable controls.
element 'anothercontrol' not known element. can occur if there compilation error in web site, or web.config file missing.
obviously, web.config files there. what's interesting project does compile , web pages do show user controls. it's visual studio designers crash above error.
asp.net webforms user-controls web-config
Comments
Post a Comment