Attempting to dynamically set the SkinID based for an asp:button embedded in a custom UserControl. Calling the SetNavBar method pasted below in the Page_Load event yields the following exception:
The 'SkinId' property can only be set in or before the Page_PreInit event for static controls. For dynamic controls, set the property before adding it to the Controls collection.
Unfortunately the "System.Web.UI.UserControl" doesn't seem to have a Page_PreInit and attempting to define one manually and attach the event handler such as with the following line:
Page.PreInit += new EventHandler(Page_PreInit);
Go to the complete details ...