Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Collections properties in custom controls

Reply
Thread Tools

Collections properties in custom controls

 
 
Roberto Ferreira
Guest
Posts: n/a
 
      04-17-2006
Hi, How I can create collections properties in my custom controls in ASP.net
(C#), I need create properties inside other propierties. Thanks! My english
is bad, excuse me!



 
Reply With Quote
 
 
 
 
CMM
Guest
Posts: n/a
 
      04-18-2006
Apparently this is not possible with UserControls (well, you can, but they
can't be edited via the Property Editor in the Designer). For Custom
Controls (derived or composite) you can try decorating your collection
property as so:

<DesignerSerializationVisibility(DesignerSerializa tionVisibility.Content), _
PersistenceMode(PersistenceMode.InnerProperty), _
NotifyParentProperty(True)> _
Public ReadOnly Property MyItems() As ...

And pray a little.

P.S. Custom controls (Derived, Composite, or User) ABSOLUTELY SUCK in
ASP.NET 2.0.


--
-C. Moya
www.cmoya.com
"Roberto Ferreira" <> wrote in message
news:...
> Hi, How I can create collections properties in my custom controls in
> ASP.net (C#), I need create properties inside other propierties. Thanks!
> My english is bad, excuse me!
>
>
>



 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      04-19-2006
hi roberto, first you need to create your collection class, this will be the
type of your property in your custom control. If you need to know how to
define a collection class, take a look at the following documentation on
msdn.
http://msdn2.microsoft.com/en-US/lib...ctionbase.aspx

Once you have this defined, make a public property in your custom control
with a getter accessor only. No setter =P
Ok, another thing i'm not clear with is when you say property of a property
? It seems to me you do not want a collection property but a property with a
complex type. If this is the case then instead of a collection class you can
have a normal class and this will be the type of your property.

A good, full working example for collection properties is also available on
msdn articles, take a look :
http://msdn2.microsoft.com/en-us/lib...4x(VS.80).aspx
Even though this one uses an arraylist(simplicity at its best), its a good
example and gives you a good idea on how to proceed.

If you are still confused, feel free to ask.
Have a good day,

Alessandro Zifiglio
"CMM" <> ha scritto nel messaggio
news:%23tbw$...
> Apparently this is not possible with UserControls (well, you can, but they
> can't be edited via the Property Editor in the Designer). For Custom
> Controls (derived or composite) you can try decorating your collection
> property as so:
>
> <DesignerSerializationVisibility(DesignerSerializa tionVisibility.Content),
> _
> PersistenceMode(PersistenceMode.InnerProperty), _
> NotifyParentProperty(True)> _
> Public ReadOnly Property MyItems() As ...
>
> And pray a little.
>
> P.S. Custom controls (Derived, Composite, or User) ABSOLUTELY SUCK in
> ASP.NET 2.0.
>
>
> --
> -C. Moya
> www.cmoya.com
> "Roberto Ferreira" <> wrote in message
> news:...
>> Hi, How I can create collections properties in my custom controls in
>> ASP.net (C#), I need create properties inside other propierties. Thanks!
>> My english is bad, excuse me!
>>
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why the properties of web user controls which inherted from my custom base UI controls MISSED? ABC ASP .Net Building Controls 0 11-21-2005 04:08 AM
Why the properties of web user controls which inherted from my custom base UI controls missed? ABC ASP .Net 0 11-21-2005 04:08 AM
Sorting collections based on nested collections Doug Poland Java 9 09-27-2003 10:46 PM
Accessing Properties of Custom Controls child Controls Moldy ASP .Net Building Controls 8 09-05-2003 03:39 PM
InnerProperty Persistance for Collections containing other Collections mutex ASP .Net Building Controls 0 07-27-2003 02:45 PM



Advertisments
 



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