Hi there
Sorry for the shout in the subject but I have been trying to skin a custom class from a class libarary I feel im just missing a little something.
I have a Solution with a website and a class library (called wem.portal)
In the class library I have a simple custom control with just a label. See bottom of this post for the full code
In the website I call my custom control using the following register and custom tag
<%@ Register Assembly="WEM.Portal" Namespace="WEM.Portal.UI" TagPrefix="WEMui" %>
<WEMui:TestThemeClass runat="server" ID="someid" />
At this point all works well (I have not yet created a skin)
The problem is that when I create a skin file using the same register line of code
<%@ Register Assembly="WEM.Portal" Namespace="WEM.Portal.UI" TagPrefix="WEMui" %>
<WEMui:TestThemeClass runat="server" skinID="blue" /> and run the code the compiler has trouble creating the skin theme blue because it can not define the type WEM.Portal.UI.TestThemeClass see message below
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'WEM.Portal.UI.TestThemeClass' is not defined.
Line 129: Private Shared __BuildControl__control64_skinKey As Object = System.Web.UI.PageTheme.CreateSkinKey(GetType(WEM.Portal.UI.TestThemeClass), "blue")
I have managed to get the code working when the code is stored in the App_Code but when I move it to the class library it has this namespace problem
My custom Class:
Option Strict On
Imports System
Imports System.ComponentModel
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Namespace UI
< _
AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal), _
AspNetHostingPermission(SecurityAction.InheritanceDemand, _
Level:=AspNetHostingPermissionLevel.Minimal), _
ToolboxData("<{0}:TestThemeClass> </{0}:TestThemeClass>") _
> _
Public Class TestThemeClass
Inherits CompositeControl
Private LeftLabel As Label
Protected Overrides Sub CreateChildControls()
LeftLabel = New Label
LeftLabel.ID = "lblLeftLabel"
LeftLabel.Text = "Left List"
LeftLabel.CssClass = "ijb"
Me.Controls.Add(LeftLabel)
End Sub
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
LeftLabel.RenderControl(writer)
End Sub
Protected Overrides Sub RecreateChildControls()
EnsureChildControls()
End Sub
End Class
End Namespace