Collections as properties?

P

Paul Louth

Hi, I'm creating my own custom web-control called Table, with a collection
of my own custom 'Column's as a property:

[ToolboxData("<{0}:Table runat=server></{0}:Table>")]
public class Table : System.Web.UI.WebControls.WebControl
{
...
[Bindable(true)]
public ColumnCollection Columns
{
get { return columns; }
set { columns = value; }
}
}

However when I create the Table in the designer, and attempt to add items to
the Columns attribute the attribute just has a value of "(Collection)". It
'appears' to work in the designer, but no actual content is being written in
the HTML view.

So, what's the correct way of attaching collections to controls?

Thanks in advance,

Paul
 
P

Paul Louth

Ok, in case you were wondering this is how I achieved it.

I set the PersistenceMode to InnerProperty, which then embedded the
ColumnCollection:

[Bindable(true), PersistenceMode(PersistenceMode.InnerProperty)]
public ColumnCollection Columns
{
get { return columns; }
set { columns = value; }
}
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top