When using User Controls in ASP.NET it is a good practice to register the controls in Web.Config. By doing this you won't need to register the user control on every single aspx site that it should be used on. (See code example)
Here I have registered two custom user control and also the AjaxControlToolkit inside the web.config (see code line 8-10).
One problem that might arise when doing this approach is when you need to nestle one control inside another control. This will generate a compiling error saying something like:
The page '/MyProject/App_UserControls/Personnel.ascx' cannot use the user control '/MyProject/App_UserControls/DateSelector.ascx', because it is registered in web.config and lives in the same directory as the page. C:\My Projects\App_UserControls\Personnel.ascx
A solution for this problem is to re-register the DateSelector user control inside the Personnel.ascx file as the following code (see code line 4):
Wednesday, January 7, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment