Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Control Builder not parsing attributes in AddParsedSubObject

Reply
Thread Tools

Control Builder not parsing attributes in AddParsedSubObject

 
 
Scot Meyer
Guest
Posts: n/a
 
      01-15-2004
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(BookCounterBuilde r)), 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

lease 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 @ .
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where's a DOM builder that uses the Builder Pattern to ... buildDOMs? Phlip Python 5 01-13-2010 12:48 PM
xml builder not able to create namespaced elements w/attributes?? Stephen Bannasch Ruby 1 07-23-2006 02:36 PM
AddParsedSubObject breaks after upgrading to VS.NET 2005 RC Steve Franks ASP .Net 2 10-25-2005 06:24 PM
Help needed with AddParsedSubObject() and ControlBuilder() Chris Simeone ASP .Net Building Controls 0 10-29-2004 04:28 PM
AddParsedSubObject and LoadViewState Michael Combs ASP .Net Building Controls 4 05-25-2004 07:11 PM



Advertisments