maybe u can use controls???
Imports System
Imports System.Collections
Imports System.Web
Imports System.Web.UI
NameSpace Hi
Public Class TagBuilder
Inherits ControlBuilder
Public Overrides function GetChildControlType(Tag as String, Attributes As IDictionary) as Type
if Tag.toLower()="item" then
return GetType(ControlItem)
end if
return nothing
end function
end class
<ControlBuilderAttribute(GetType(TagBuilder))> _
Public Class CustomControl
Inherits Control
Public Text as string
Public TextColor as string
Dim ControlList as new ArrayList()
Protected Overrides Sub AddParsedSubObject(obj as Object)
if (typeof obj is ControlItem) then
ControlList.add(obj)
end if
end sub
Protected Overrides Sub Render(Writer as HtmlTextWriter)
Writer.AddAttribute("Color",TextColor)
Writer.RenderBeginTag("font")
Writer.write(Text)
Writer.RenderEndTag()
Dim Ctrl as ControlItem
for each Ctrl in ControlList
Writer.AddAttribute("Color",Ctrl.Color)
Writer.RenderBeginTag("font")
Writer.write(Ctrl.Text)
Writer.RenderEndTag()
next
end sub
End Class
Public Class ControlItem
Inherits Control
Public Text as string
Public Color as string
Dim ControlList as new ArrayList()
Protected Overrides Sub AddParsedSubObject(obj as Object)
if (typeof obj is LiteralControl) then
if(obj.text)<>"" then
Text=obj.text
end if
end if
end sub
end class
End NameSpace
<Hi:CustomControl runat="server" Text="Hello" TextColor="red">
<item color="green">This is the goddamn text</item>
</Hi:CustomControl>
Known is handfull, Unknown is worldfull