Collection Editor vs. Item ID

J

John Saunders

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.
 
V

Victor Garcia Aprea [MVP]

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.
 
V

Victor Garcia Aprea [MVP]

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.
 
J

John Saunders

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
(e-mail address removed)
 
Y

Yan-Hong Huang[MSFT]

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" <[email protected]>
!References: <[email protected]> <[email protected]>
!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: <[email protected]>
!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
[email protected]
!
!!> 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.
!>
!> !> > 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
!> > (e-mail address removed)
!> >
!> >
!> >
!>
!>
!
!
!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top