473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Collection Editor in Composite Controls

i have following sample Control

[ParseChildren(true)]
[PersistChildren(true)]
public class MyControl: System.Web.UI.Control
{
MyCollection values_ = new MyCollection ();

[PersistenceMode(PersistenceMode.InnerProperty),

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)]
public MyCollection Values
{
get
{
return values_;
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit (e);
//...
}

protected override void Render(HtmlTextWriter writer)
{
base.Render (writer);
//...
}
}

//Collection:
public class MyCollection : CollectionBase
{
public MyItem this[int index]
{
get
{
return this.InnerList[index] as MyItem ;
}
}

public MyItem Add(MyItem item)
{
this.InnerList.Add(item);
return item;
}
}
//Item - its NOT control, same as Columns in Datagrid
public class MyItem
{
protected string prop_;
public string Prop
{
get{return prop_;}
set{prop_ = value;}
}
}

it's work Perfect if I fill control by Hand in ASPX :

<cc1:MyControl id=MyControl1 runat="server" >
<Values>
<cc1:MyItem Prop="value1"/>
<cc1:MyItem Prop="value2"/>
<cc1:MyItem Prop="value3"/>
</Values>
</cc1:MyControl>
Now I want to have ability fill control with same structure
in designer.When I click "..." button in property grid on Values row -
Collection Editor is Open and I may do add|remove my Items.But when I click
"OK", in ASPX control stay empty

<cc1:MyControl id=MyControl1 runat="server" >
</cc1:MyControl>

Much more, if control have existing items in aspx view, it's
deleted.Whats wrong?


Nov 18 '05 #1
1 1003
Hi,

PersistChildren should be false.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sundown | last post by:
I am trying to create a custom button control for the web that, when clicked, disables and changes the text of itself and a bunch of other controls (in the collection). My goal is to end up with a...
2
by: Harry | last post by:
Hello, I have a composite WebControl that I'm dynamically instantiating at runtime using Reflection. When I create a new instance of my control I immediately iterate through it's child control...
2
by: Harry | last post by:
Hello, I have a composite WebControl that I'm dynamically instantiating at runtime using Reflection. When I create a new instance of my control I immediately iterate through it's child control...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.