How Visual Studio 2008 registers web user controls in Web.config files
This article mainly introduces how Visual Studio 2008 registers web user controls in the Web.config file. The article is very detailed and has certain reference value. Interested friends must read it!
If the location of the web user control is moved in the future, then every page that uses the web user control needs to modify the registration instruction, which is a very troublesome thing. If the registration instruction is moved to the web.config file, then the path of the file will be changed much easier, any location change update can be completed in one location. Enter the following in Web.Config:
< configuration> < system.web> < pages> < controls> < add tagPrefix="MyControl" src="~/Controls/WebUserControl.ascx" tagName="MyButton"/> < /controls> < /pages> < /system.web> < /configuration>Once the web config is configured as above, you can use the web user control on any page of the project.
< body> < form id="form1" runat="server">MyButton ID= "MyUserControl" runat= "server" / > form >
< /body>I really didn't know that the web user control could be registered in Asp.net 's web.config. The design of this function is very user-friendly and thoughtful.
The above is all the contents of the article "how Visual Studio 2008 registers web user controls in Web.config files". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!