• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

Array type Server Control Property

I have a server control that needs an array of strings.
How you manage this?
I could add a property of type string like;
public virtual string Items{get{}set{}}
and when the developer fills the property like;
"string1;string2;string3"
then I can pick the strings from that property for my use but is this the right way?

I search the web to find a property (Designer) that takes items like  a listview, a combobox but could find anything.
I'm using VS 2005 Asp.Net with C#.  
Thanks,
0
kosturdur
Asked:
kosturdur
1 Solution
 
mikeuttCommented:
Have you tried creating a property that is a list of objects to hold the strings. Then decorate that property with
[PersistenceMode(PersistenceMode.InnerProperty)]

Sort of like this

public List<TheString> _listOfStrings;
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public List<TheString> ListOfStrings
{
get { return _listOfStrings; }
set { _listOfStrings = value; }
}


Then at design time your ASP control can be marked up like so


<cc1:webcustomcontrol1 id="WebCustomControl1_1" runat="server">
<ListOfStrings >
<cc1:TheString StringValue="one" />
<cc1:TheString StringValue="two" />
<cc1:TheString StringValue="three" />
<cc1:TheString StringValue="four" />
</ListOfStrings>
</cc1:webcustomcontrol1>

Check out http://msdn2.microsoft.com/en-us/library/system.web.ui.persistencemode(VS.80).aspx
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now