how to persist my CustomControl's subcontrol

L

lao.pan

I create a custom control with subcontrol.but in design-
time, subcontrol contents are clear by VS when I change
any attribute of the control.
why?
thank!

the main code is:
[
ParseChildren(false),
ControlBuilderAttribute(typeof(MyControlBuilder)),
]
public class MyCS_CustomControl: System.Web.UI.Control,
INamingContainer
{
private CellCollection _Items=new
CellCollection();

[
Category("Data"),
DefaultValue(null),
MergableProperty(false),
PersistenceMode
(PersistenceMode.InnerDefaultProperty),
]
public virtual CellCollection Items
{
get { return _Items; }
}
}

CellCollection is inherit from CollectionBase,Item is a
sample class

the html tag is:
<custom:mycs_customcontrol id="csTableId" title="C#
Custom1 Control Table" runat="server" columns="2"
rows="2">
<CUSTEM:MYCELL Text="RED"
BackColor="red" CellID="r1c1"></CUSTEM:MYCELL>

</custom:mycs_customcontrol></form>

at run-time all ok, but mycell clear in designtime when
control-attr changed.
 

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,054
Latest member
TrimKetoBoost

Latest Threads

Top