exposing collection/array type properties

W

wh

I have a user control implemented in an .ascx page that I embed in the html
as follows:

<test:mycontrol runat="server" property1="..." property2="..."/>

I'd also like to be able to assign a collection of strings to a property
called 'items' but am unsure of whether this is possible, and if so how it
can be done.

I'd presumably have a property in the codebehind .cs file for the .ascx
control that looks like:

public Array Items
{
get { return m_Items; }
set { m_Items = value; }
}

How would I then specify the property in the control declaration in the html
file?

Wayne.
 
K

Kevin Spencer

How would I then specify the property in the control declaration in the
html

Is there some reason why you would have to? Why not just set the property in
the code? If it is absolutely necessary for some reason, you could convert
your "collection of strings" (array?) to a comma-delimited string.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
W

wh

There's no reason why I have to, I just thought it was the correct method to
use simply because it is what is used by the .NET web controls. For example,
the asp:listbox allows you to declare the contents as asp:listitem tags:

<asp:listbox ... >
<asp:listitem ... />
<asp:listitem selected="true"... />
<asp:listitem ... />
<asp:listitem ... />
</asp:listbox>

I need to achieve a similar thing, that is being able to expose a collection
of objects with the possibility of being able to set attributes for each
one; something I'd not be able to do if I exposed the property as a comma
delimitted string.

Thanks for your reply though,
Wayne.
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top