Control Builder not parsing attributes in AddParsedSubObject

S

Scot Meyer

Here is my problem when I Create a control builder which returns the type of the object to add to the collection via AddParsedSubObject I get the right object and it is added to my collection. However the property Text is not populated with "Test1" it actually contains Nothing. The funny thing is if I uncomment out the 'Me.Controls.Add(obj) in the AddParsedSubObject the property is populated. What am I missing here? Must I always add it to the control collection? Is there a way to parse the attributes within the control that I am missing? Btw: the attributes parameter in the GetChildControlType function within control builder actually contains the attributes I am looking for so I know that it did parse them. It however did not perform any action agains them. e.g. the attribute(0) contains "<%# GetString("This is a test") %>" so it must not have evaulated the content yet. Maybe because a databind is missing in the MiniItem tag class


HTM

<org:MainTag runat="server"><org:MiniTag Text="Test1" /><org:MiniTag Text="Test2" /></org:MainTag


' MiniTag Clas

<ParseChildren(True), DefaultProperty("File"), ToolboxData("<{0}:MiniTag runat=server></{0}:MiniTag>")> Public Class MiniTa
Inherits System.Web.UI.WebControls.WebContro
Implements INamingContaine

Private mText As String = "" 'Text of ta

' Name: Tex
' Description: Gets or sets the text to display in the gray bar are
<Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]() As Strin
Ge
Return mTex
End Ge

Set(ByVal Value As String
mText = Valu
End Se
End Propert
End Clas


' MainTag Clas

<ControlBuilderAttribute(GetType(BookCounterBuilder)), ParseChildren(False), ToolboxData("<{0}:MyMainTag runat=server></{0}:MyMainTag>")> Public Class MyMainTa
Inherits System.Web.UI.WebControls.WebContro
Implements INamingContaine

Protected Overrides Sub AddParsedSubObject(ByVal obj As Object
If TypeOf obj Is MiniTag The
mItems.Add(obj
End I
' Me.Controls.Add(obj
End Su
End Clas


' ControlBuilder Clas

Friend Class BookCounterBuilde
Inherits ControlBuilde

Public Overrides Function GetChildControlType(ByVal tagName As String, ByVal attributes As IDictionary) As Typ
If (tagName.ToLower.EndsWith("MiniTag")) The
Return GetType(MiniTag
End I
Return Nothin
End Functio

Public Overrides Sub AppendLiteralString(ByVal s As String
End Su
End Clas

:please keep the responses in the thread as this will help others that may have similar problem
mailmeat: scotchy32000 at yahoo nospam dot com <- remove nospam add @ .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top