Search:
Namespaces
Discussions
.NET v1.1
Feedback
Error in Design View
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngcontrolscs' list
.
Peter Blum
I have built a composite control with one of its properties as an
ArrayList
.
It works well except in Design View.
Sample:
public class MyControl : Control,
INamingContainer
{
private
ArrayList
_ArrayList = new
ArrayList
()
public
ArrayList
myArrayList { get {return _ArrayList; } }
}
myArrayList is a container for this class:
public class ColorHolder
{
private
Color
_color =
Color
.Empty;
public
Color
myColor { get {return _color;} set { _color = value }}
public ColorHolder() { } // constructor
}
The user is allowed to add items to this property in the control's ASP.NET
code. Sample:
<prefix:MyControl id="id1" runat="server">
<myArrayList>
<prefix:ColorHolder myColor=red />
<prefix:ColorHolder myColor=green />
<prefix:ColorHolder myColor=blue />
</myArrayList>
</prefix:MyControl>
This successfully adds the three colors to myArrayList when the program is
compiled and the control is used. There is no need for any
IParserAccessor
attribute or
ControlBuilder
subclass to get this ASP.NET into my control.
When I switch the ASP.NET page to Design view in Visual Studio.NET (release
+ SP1), the control is shown with the error "Error Creating Control" and the
tooltip hint says "could not be set on property 'myArrayList'.
While there is a
ControlDesigner
subclass, I can disable it and the problem
remains (even after exiting VS.NET and rebuilding on restart).
Any ideas? If not, any suggestions on how to debug the problem?
--- Peter Blum
Reply to this message...
TIM ELLISON
If there are no other child controls that are allowed to persist in
"MyControl", set your "myArrayList" class' constructor to receive a
"MyControl", hold the "MyControl" instance and add the ColorHolder instances
to your "MyControl" controls array. IOW, MyControl's control array actually
becomes your container for the ColorHolder collection.
Regards,
Tim Ellison
Senior Web Applications Developer,
Long and Foster Real Estate
703-359-1884
Click here to reveal e-mail address
-----Original Message-----
From: Peter Blum [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, May 01, 2002 4:52 PM
To: aspngcontrolscs
Subject: [aspngcontrolscs] Error in Design View
I have built a composite control with one of its properties as an
ArrayList
.
It works well except in Design View.
Sample:
public class MyControl : Control,
INamingContainer
{
private
ArrayList
_ArrayList = new
ArrayList
()
public
ArrayList
myArrayList { get {return _ArrayList; } }
}
myArrayList is a container for this class:
public class ColorHolder
{
private
Color
_color =
Color
.Empty;
public
Color
myColor { get {return _color;} set { _color = value }}
public ColorHolder() { } // constructor
}
The user is allowed to add items to this property in the control's ASP.NET
code. Sample:
<prefix:MyControl id="id1" runat="server">
<myArrayList>
<prefix:ColorHolder myColor=red />
<prefix:ColorHolder myColor=green />
<prefix:ColorHolder myColor=blue />
</myArrayList>
</prefix:MyControl>
This successfully adds the three colors to myArrayList when the program is
compiled and the control is used. There is no need for any
IParserAccessor
attribute or
ControlBuilder
subclass to get this ASP.NET into my control.
When I switch the ASP.NET page to Design view in Visual Studio.NET (release
+ SP1), the control is shown with the error "Error Creating Control" and the
tooltip hint says "could not be set on property 'myArrayList'.
While there is a
ControlDesigner
subclass, I can disable it and the problem
remains (even after exiting VS.NET and rebuilding on restart).
Any ideas? If not, any suggestions on how to debug the problem?
--- Peter Blum
| [aspngcontrolscs] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngcontrolscs.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
Peter Blum
Thanks Tim. I found a simpler solution. Use the PersistChildren(true)
attribute on the class. I can continue using my own object classes that way.
--- Peter
"TIM ELLISON" <
Click here to reveal e-mail address
> wrote in message
news:648476@aspngcontrolscs...
[Original message clipped]
Reply to this message...
TIM ELLISON
The major advantage to using the approach I stated is so that your users of
your control can only persist whatever your child class is. Anything else
would be considered invalid.
You'd still persist children in your outer control.
Regards,
Tim Ellison
Senior Web Applications Developer,
Long and Foster Real Estate
703-359-1884
Click here to reveal e-mail address
-----Original Message-----
From: Peter Blum [mailto:
Click here to reveal e-mail address
]
Sent: Sunday, May 05, 2002 11:55 AM
To: aspngcontrolscs
Subject: [aspngcontrolscs] Re: Error in Design View
Thanks Tim. I found a simpler solution. Use the PersistChildren(true)
attribute on the class. I can continue using my own object classes that way.
--- Peter
"TIM ELLISON" <
Click here to reveal e-mail address
> wrote in message
news:648476@aspngcontrolscs...
[Original message clipped]
| [aspngcontrolscs] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngcontrolscs.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
System.Collections.ArrayList
System.Drawing.Color
System.Web.UI.ControlBuilder
System.Web.UI.Design.ControlDesigner
System.Web.UI.INamingContainer
System.Web.UI.IParserAccessor
System.Windows.Forms.Design.ControlDesigner
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com