Help with using a custom collection as a property for a TextBox derrived control.

Discussion in 'ASP .Net Building Controls' started by Chris Crowe [MVP], Aug 21, 2005.

  1. Hi

    I am creating a new TextBox control but I am having problems when I am
    trying to add my own collection to the control and persisting the values to
    the asp.net web page.

    This is my code for the collection property

    [PersistenceMode(PersistenceMode.InnerProperty)]
    public LookupEditControlColumns ListColumns

    This is correctly persisting the data as follows:

    <cc1:lookupeditcontrol id="LookupEditControl2" runat="server"
    PopupWindow="True" LookupURL="search.aspx?ctrl=name&amp;v=">
    <ListColumns>
    <cc1:LookupEditControlColumn Width="100%"></cc1:LookupEditControlColumn>
    </ListColumns>
    </cc1:lookupeditcontrol>

    But when you open the .aspx page I get the following problem.

    The text property of the control contains the following

    <ListColumns>
    <cc1:LookupEditControlColumn
    Width="100%"></cc1:LookupEditControlColumn>
    </ListColumns>

    and my collection is empty.

    How do I handle this situation?

    Is there anything else I must do when I want to persist my custom collection
    properties?

    --
    Cheers

    Chris

    Chris Crowe [IIS MVP]
    Chris Crowe [MVP], Aug 21, 2005
    #1
    1. Advertising

  2. Chris Crowe [MVP]

    Shaun Wilde Guest

    RE: Help with using a custom collection as a property for a TextBox de

    I have a similar issue as you and I found this article that seems to have a
    good answer that I am going to employ myself - I've been using a similar
    trick (i.e. calling OnComponentChanged - have a search for
    notifyDesignerOfChange in this group) with a simple string property but the
    collection property was causing issues (i.e. sometimes saving and sometimes
    not)

    "Chris Crowe [MVP]" wrote:

    > Hi
    >
    > I am creating a new TextBox control but I am having problems when I am
    > trying to add my own collection to the control and persisting the values to
    > the asp.net web page.
    >
    > This is my code for the collection property
    >
    > [PersistenceMode(PersistenceMode.InnerProperty)]
    > public LookupEditControlColumns ListColumns
    >
    > This is correctly persisting the data as follows:
    >
    > <cc1:lookupeditcontrol id="LookupEditControl2" runat="server"
    > PopupWindow="True" LookupURL="search.aspx?ctrl=name&v=">
    > <ListColumns>
    > <cc1:LookupEditControlColumn Width="100%"></cc1:LookupEditControlColumn>
    > </ListColumns>
    > </cc1:lookupeditcontrol>
    >
    > But when you open the .aspx page I get the following problem.
    >
    > The text property of the control contains the following
    >
    > <ListColumns>
    > <cc1:LookupEditControlColumn
    > Width="100%"></cc1:LookupEditControlColumn>
    > </ListColumns>
    >
    > and my collection is empty.
    >
    > How do I handle this situation?
    >
    > Is there anything else I must do when I want to persist my custom collection
    > properties?
    >
    > --
    > Cheers
    >
    > Chris
    >
    > Chris Crowe [IIS MVP]
    >
    >
    >
    Shaun Wilde, Aug 24, 2005
    #2
    1. Advertising

  3. Chris Crowe [MVP]

    Shaun Wilde Guest

    RE: Help with using a custom collection as a property for a TextBo

    oops forgot to put link in :) http://weblogs.asp.net/ngur/articles/144770.aspx

    "Shaun Wilde" wrote:

    > I have a similar issue as you and I found this article that seems to have a
    > good answer that I am going to employ myself - I've been using a similar
    > trick (i.e. calling OnComponentChanged - have a search for
    > notifyDesignerOfChange in this group) with a simple string property but the
    > collection property was causing issues (i.e. sometimes saving and sometimes
    > not)
    >
    > "Chris Crowe [MVP]" wrote:
    >
    > > Hi
    > >
    > > I am creating a new TextBox control but I am having problems when I am
    > > trying to add my own collection to the control and persisting the values to
    > > the asp.net web page.
    > >
    > > This is my code for the collection property
    > >
    > > [PersistenceMode(PersistenceMode.InnerProperty)]
    > > public LookupEditControlColumns ListColumns
    > >
    > > This is correctly persisting the data as follows:
    > >
    > > <cc1:lookupeditcontrol id="LookupEditControl2" runat="server"
    > > PopupWindow="True" LookupURL="search.aspx?ctrl=name&v=">
    > > <ListColumns>
    > > <cc1:LookupEditControlColumn Width="100%"></cc1:LookupEditControlColumn>
    > > </ListColumns>
    > > </cc1:lookupeditcontrol>
    > >
    > > But when you open the .aspx page I get the following problem.
    > >
    > > The text property of the control contains the following
    > >
    > > <ListColumns>
    > > <cc1:LookupEditControlColumn
    > > Width="100%"></cc1:LookupEditControlColumn>
    > > </ListColumns>
    > >
    > > and my collection is empty.
    > >
    > > How do I handle this situation?
    > >
    > > Is there anything else I must do when I want to persist my custom collection
    > > properties?
    > >
    > > --
    > > Cheers
    > >
    > > Chris
    > >
    > > Chris Crowe [IIS MVP]
    > >
    > >
    > >
    Shaun Wilde, Aug 24, 2005
    #3
  4. Re: Help with using a custom collection as a property for a TextBox de

    Thanks Shaun

    I will into that solution - at this time I basically wet back to using a
    WebControl and then adding the code to make it back to a TextBox which is
    working for me.

    Cheers

    Chris

    Chris Crowe [IIS MVP]
    http://blog.crowe.co.nz


    "Shaun Wilde" <> wrote in message
    news:...
    >I have a similar issue as you and I found this article that seems to have a
    > good answer that I am going to employ myself - I've been using a similar
    > trick (i.e. calling OnComponentChanged - have a search for
    > notifyDesignerOfChange in this group) with a simple string property but
    > the
    > collection property was causing issues (i.e. sometimes saving and
    > sometimes
    > not)
    >
    > "Chris Crowe [MVP]" wrote:
    >
    >> Hi
    >>
    >> I am creating a new TextBox control but I am having problems when I am
    >> trying to add my own collection to the control and persisting the values
    >> to
    >> the asp.net web page.
    >>
    >> This is my code for the collection property
    >>
    >> [PersistenceMode(PersistenceMode.InnerProperty)]
    >> public LookupEditControlColumns ListColumns
    >>
    >> This is correctly persisting the data as follows:
    >>
    >> <cc1:lookupeditcontrol id="LookupEditControl2" runat="server"
    >> PopupWindow="True" LookupURL="search.aspx?ctrl=name&v=">
    >> <ListColumns>
    >> <cc1:LookupEditControlColumn Width="100%"></cc1:LookupEditControlColumn>
    >> </ListColumns>
    >> </cc1:lookupeditcontrol>
    >>
    >> But when you open the .aspx page I get the following problem.
    >>
    >> The text property of the control contains the following
    >>
    >> <ListColumns>
    >> <cc1:LookupEditControlColumn
    >> Width="100%"></cc1:LookupEditControlColumn>
    >> </ListColumns>
    >>
    >> and my collection is empty.
    >>
    >> How do I handle this situation?
    >>
    >> Is there anything else I must do when I want to persist my custom
    >> collection
    >> properties?
    >>
    >> --
    >> Cheers
    >>
    >> Chris
    >>
    >> Chris Crowe [IIS MVP]
    >>
    >>
    >>
    Chris Crowe [MVP], Aug 24, 2005
    #4
    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. Lloyd Dupont
    Replies:
    0
    Views:
    461
    Lloyd Dupont
    Jul 27, 2003
  2. -=Chris=-
    Replies:
    2
    Views:
    5,583
    -=Chris=-
    May 23, 2004
  3. Rene Aichinger
    Replies:
    0
    Views:
    541
    Rene Aichinger
    Dec 7, 2005
  4. easy
    Replies:
    9
    Views:
    323
    Ulrich Hobelmann
    May 30, 2006
  5. Øyvind Isaksen
    Replies:
    1
    Views:
    960
    Øyvind Isaksen
    May 18, 2007
Loading...

Share This Page