I have built a Custom Control Class that makes it much easier to build a side bar element in my html.
The problem I am running into is that when I set the "Text" property, the last time I set it gets used for every instance of the control on my page. This is my first time doing this, so I'm assuming I'm missing something basic.
Namespace CustomControl
Public Class SideBarElement : Inherits Literal
''' <summary>
''' Create Copyright Label
''' </summary>
''' <remarks></remarks>
Protected Overrides Sub CreateChildControls()
MyBase.Text = RenderHTML()
MyBase.CreateChildControls()
End Sub
''' <summary>
''' Set all copyright information.
''' </summary>
Public Shared Function RenderHTML() As String
Dim val As String
val = "<div class=""side-bar-container"">" & _
"<div class=""side-bar-top"">" & _
"</div>" & _
" <div class=""side-bar-content"">" & _
_Text & _
"</div>" & _
"<div class=""side-bar-bottom"">" & _
"</div>" & _
"</div>"
Return val
End Function
''' <summary>
''' Create Text Property
''' </summary>
''' <remarks></remarks>
Private Shared _Text As String = String.Empty
Public Shadows Property Text() As String
Get
Return _Text
End Get
Set(ByVal value As String)
_Text = value
End Set
End Property
End Class
End Namespace
Using this control is supposed to look like this.
<sidebar:SideBarElement ID="SideBarElement1" runat="server">
Bla Bla</br>My Fun Content.</sidebar:SideBarElement>
Any help will be greatly appreciated.