'Declaration Protected Sub InitializeStyle( _ ByVal StylePropertyId As String, _ ByVal styleRef As Style _ )
protected void InitializeStyle( string StylePropertyId, Style styleRef )
Exception | Description |
---|---|
System.NullReferenceException | Thrown when the StylePropertyId argument is null (Nothing in VB.NET), or when the SmartWebControl subclass' overridden ControlPrefix implementation returns null (Nothing in VB.NET) instead of a non-null string prefix. |
This method initializes the Style object to take on the default appearance specified by a CSS class in an external stylesheet. CSS classes in an external stylesheet maintain a consistent naming convention by which their names are well-known, and can be connected to the appropriate Style properties at init-time by this method.
Name collisions are avoided because InitializeStyle will read the ControlPrefix to produce an appropriately-qualified CSS class name based on StylePropertyId for the initialized styleRef.
Inheritors should call this method immediately after lazily creating an empty Style object reference, but before tracking viewstate on it, for any Style properties added by their subclass. Failure to call this method when initializing a Style property will cause the Style not to appear as if based upon the style rules in the external stylesheet. A subclass may assume responsibility for performing their own Style property initializations at this recommended point in time after lazy creation and before tracking viewstate, but should not expect the Style property to function correctly with the default external stylesheet.
The CssClass can be set to work with other external or embedded CSS classes, of course.
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2