Control Builder not parsing attributes in AddParsedSubObject

Discussion in 'ASP .Net Web Controls' started by Scot Meyer, Jan 15, 2004.

  1. Scot Meyer

    Scot Meyer Guest

    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 @ .
    Scot Meyer, Jan 15, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Franks
    Replies:
    2
    Views:
    459
    Steve Franks
    Oct 25, 2005
  2. Phlip
    Replies:
    5
    Views:
    550
    Stefan Behnel
    Jan 13, 2010
  3. Michael Combs

    AddParsedSubObject and LoadViewState

    Michael Combs, May 18, 2004, in forum: ASP .Net Building Controls
    Replies:
    4
    Views:
    148
    Teemu Keiski
    May 25, 2004
  4. Chris Simeone

    Help needed with AddParsedSubObject() and ControlBuilder()

    Chris Simeone, Oct 29, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    126
    Chris Simeone
    Oct 29, 2004
  5. Stephen Bannasch
    Replies:
    1
    Views:
    157
Loading...

Share This Page