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

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

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

    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] Guest

  2. Similar Questions and Discussions

    1. Collection Property in web custom control
      Hi all, I'm building a custom control. I would like that on the control you can set some 'rights' For that I have an enum: public enum...
    2. Custom Control - Collection Property
      Hey gang. I am taking the task of trying to learn how to write custom web controls. I have started with inheriting from the VS 2005 default which...
    3. Nested Collection property in a custom control
      I have the extactly the same problem.. I am creating a control where a collection property is exposed which has a nested collection object. It...
    4. Collection Property of Another Custom Server Control
      Hi, I read more and figured out how to build what I needed: <cc> <item></item> <item></item> </cc> when <item> is an editable control in...
    5. Custom Control nad Collection property
      I have a collection-property on my control. I Add the items through a collection editor, and items tags appears. <bugge:Control>...
  3. #2

    Default 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 Guest

  4. #3

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

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

    "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 Guest

  5. #4

    Default 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]
    [url]http://blog.crowe.co.nz[/url]


    "Shaun Wilde" <shaun_wilde@nospam.nospam> wrote in message
    news:60C7E19D-4DE7-4380-97AF-288DACFE0160@microsoft.com...
    >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] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139