Collection Editor vs. Item ID

Discussion in 'ASP .Net Building Controls' started by John Saunders, Jul 19, 2003.

  1. I'm using the standard CollectionEditor to allow design-time editing of a
    list of controls, all of the same type. I notice that when you enter a new
    item and specify its "ID" property, that row in the list takes on the name
    of the ID.

    But if you close and re-open the collection editor, you find that the items
    now simply show their type.

    Is there a way to fix this? Overriding .ToString() doesn't seem to work.
    --
    John Saunders
    Internet Engineer
    John Saunders, Jul 19, 2003
    #1
    1. Advertising

  2. Hi John,

    Overriding ToString() should work ok. You could check the source code
    available for MS WebControls, if I remember correctly they do this.

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    and not by private mail.

    "John Saunders" <> wrote in message
    news:...
    > I'm using the standard CollectionEditor to allow design-time editing of a
    > list of controls, all of the same type. I notice that when you enter a new
    > item and specify its "ID" property, that row in the list takes on the name
    > of the ID.
    >
    > But if you close and re-open the collection editor, you find that the

    items
    > now simply show their type.
    >
    > Is there a way to fix this? Overriding .ToString() doesn't seem to work.
    > --
    > John Saunders
    > Internet Engineer
    >
    >
    >
    >
    Victor Garcia Aprea [MVP], Jul 19, 2003
    #2
    1. Advertising

  3. Of course when I wrote "MS WebControls" I meant "MS Internet Explorer
    WebControls" :)
    The source code is available at http://www.asp.net

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    and not by private mail.

    "John Saunders" <> wrote in message
    news:%...
    > Victor,
    >
    > I'll take a look at the WebControls.
    >
    > ToString() doesn't work. In fact, it doesn't appear to be called at all by
    > the collection editor (so Debug.WriteLine says).
    >
    > John Saunders
    >
    >
    > "Victor Garcia Aprea [MVP]" <> wrote in message
    > news:...
    > > Hi John,
    > >
    > > Overriding ToString() should work ok. You could check the source code
    > > available for MS WebControls, if I remember correctly they do this.
    > >
    > > --
    > > Victor Garcia Aprea
    > > Microsoft MVP | ASP.NET
    > > Looking for insights on ASP.NET? Read my blog:
    > > http://obies.com/vga/blog.aspx
    > > To contact me remove 'NOSPAM'. Please post all questions to the

    newsgroup
    > > and not by private mail.
    > >
    > > "John Saunders" <> wrote in message
    > > news:...
    > > > I'm using the standard CollectionEditor to allow design-time editing

    of
    > a
    > > > list of controls, all of the same type. I notice that when you enter a

    > new
    > > > item and specify its "ID" property, that row in the list takes on the

    > name
    > > > of the ID.
    > > >
    > > > But if you close and re-open the collection editor, you find that the

    > > items
    > > > now simply show their type.
    > > >
    > > > Is there a way to fix this? Overriding .ToString() doesn't seem to

    work.
    > > > --
    > > > John Saunders
    > > > Internet Engineer
    > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Victor Garcia Aprea [MVP], Jul 19, 2003
    #3
  4. Victor,

    I spent a little time with the IE WebControls, and I see that it's not just
    ToString() that does it. The fact is that, e.g., CssCollection also has a
    TypeConverter associated with it which, when asked to convert to "String",
    will call ToString.

    Also, CssCollectionEditor is an example of overriding
    CollectionEditor.GetItems and CollectionEditor.SetItems to pass a "proxy" to
    the base CollectionEditor. CssCollectionEditor translates from CssCollection
    to an array of CssAttribute instances. These simpler Name/Value objects are
    the ones with the overridden ToString method.

    As should be obvious from reading this newsgroup, the entire area of
    design-time support is one which could use a great deal better documentation
    and probably some framework improvements. If the documentation were better,
    more people might try to implement richer design-time support, leading to
    more complaints and therefore to more framework improvements...

    Thanks,
    John Saunders


    "Victor Garcia Aprea [MVP]" <> wrote in message
    news:...
    > Hi John,
    >
    > Overriding ToString() should work ok. You could check the source code
    > available for MS WebControls, if I remember correctly they do this.
    >
    > --
    > Victor Garcia Aprea
    > Microsoft MVP | ASP.NET
    > Looking for insights on ASP.NET? Read my blog:
    > http://obies.com/vga/blog.aspx
    > To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    > and not by private mail.
    >
    > "John Saunders" <> wrote in message
    > news:...
    > > I'm using the standard CollectionEditor to allow design-time editing of

    a
    > > list of controls, all of the same type. I notice that when you enter a

    new
    > > item and specify its "ID" property, that row in the list takes on the

    name
    > > of the ID.
    > >
    > > But if you close and re-open the collection editor, you find that the

    > items
    > > now simply show their type.
    > >
    > > Is there a way to fix this? Overriding .ToString() doesn't seem to work.
    > > --
    > > John Saunders
    > > Internet Engineer
    > >
    > >
    > >
    > >

    >
    >
    John Saunders, Jul 19, 2003
    #4
  5. Hello John,

    We have filed it in our KB database. Please keep an eye out for it in the future. We are looking at continual improvement, and
    it's this kind of feedback that let's us know what things you're trying to do, that we haven't yet exposed for you.

    Thanks very much for your feedback. We appreciate it very much.

    Best regards,
    Yanhong Huang
    Microsoft Online Partner Support

    Get Secure! - www.microsoft.com/security
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    !From: "John Saunders" <>
    !References: <> <>
    !Subject: Re: Collection Editor vs. Item ID
    !Date: Sat, 19 Jul 2003 16:13:08 -0400
    !Lines: 64
    !X-Priority: 3
    !X-MSMail-Priority: Normal
    !X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    !X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    !Message-ID: <>
    !Newsgroups:
    microsoft.public.dotnet.framework.aspnet.buildingcontrols,microsoft.public.dotnet.framework.windowsforms.designtime
    !NNTP-Posting-Host: pool-151-199-22-224.bos.east.verizon.net 151.199.22.224
    !Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08.phx.gbl!
    TK2MSFTNGP10.phx.gbl
    !Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.windowsforms.designtime:2658
    microsoft.public.dotnet.framework.aspnet.buildingcontrols:6702
    !X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingcontrols
    !
    !Victor,
    !
    !I spent a little time with the IE WebControls, and I see that it's not just
    !ToString() that does it. The fact is that, e.g., CssCollection also has a
    !TypeConverter associated with it which, when asked to convert to "String",
    !will call ToString.
    !
    !Also, CssCollectionEditor is an example of overriding
    !CollectionEditor.GetItems and CollectionEditor.SetItems to pass a "proxy" to
    !the base CollectionEditor. CssCollectionEditor translates from CssCollection
    !to an array of CssAttribute instances. These simpler Name/Value objects are
    !the ones with the overridden ToString method.
    !
    !As should be obvious from reading this newsgroup, the entire area of
    !design-time support is one which could use a great deal better documentation
    !and probably some framework improvements. If the documentation were better,
    !more people might try to implement richer design-time support, leading to
    !more complaints and therefore to more framework improvements...
    !
    !Thanks,
    !John Saunders
    !
    !
    !"Victor Garcia Aprea [MVP]" <> wrote in message
    !news:...
    !> Hi John,
    !>
    !> Overriding ToString() should work ok. You could check the source code
    !> available for MS WebControls, if I remember correctly they do this.
    !>
    !> --
    !> Victor Garcia Aprea
    !> Microsoft MVP | ASP.NET
    !> Looking for insights on ASP.NET? Read my blog:
    !> http://obies.com/vga/blog.aspx
    !> To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    !> and not by private mail.
    !>
    !> "John Saunders" <> wrote in message
    !> news:...
    !> > I'm using the standard CollectionEditor to allow design-time editing of
    !a
    !> > list of controls, all of the same type. I notice that when you enter a
    !new
    !> > item and specify its "ID" property, that row in the list takes on the
    !name
    !> > of the ID.
    !> >
    !> > But if you close and re-open the collection editor, you find that the
    !> items
    !> > now simply show their type.
    !> >
    !> > Is there a way to fix this? Overriding .ToString() doesn't seem to work.
    !> > --
    !> > John Saunders
    !> > Internet Engineer
    !> >
    !> >
    !> >
    !> >
    !>
    !>
    !
    !
    !
    Yan-Hong Huang[MSFT], Jul 22, 2003
    #5
    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. Stylus Studio
    Replies:
    0
    Views:
    633
    Stylus Studio
    Aug 3, 2004
  2. Dylan
    Replies:
    5
    Views:
    409
    Daniel T.
    Mar 22, 2005
  3. Øyvind Isaksen
    Replies:
    1
    Views:
    941
    Øyvind Isaksen
    May 18, 2007
  4. Jiho Han
    Replies:
    7
    Views:
    195
    Alessandro Zifiglio
    Feb 3, 2004
  5. Replies:
    1
    Views:
    274
    Tim Dot NoSpam
    May 19, 2006
Loading...

Share This Page