I have been wondering a long time how to do a public property for a User Control that work's like .NET native Item's collection Property (for Example, ListBox and ListItems):
<asp:ListBox blablabla>
<asp:ListItem></asp:ListItem> <- Inline item collection...
</asp:ListBox>
I have been checking around the web but without any sucess. I think it must be any type of attribute that i need to add to the property, OR interface that should need to be inherited by the user control, but no clue about it, and have been thinking about it long time.
I have got to work it on a custom user control, but Visual Studio didn't recognised it as a valid item collection.
Let's say that we have this userControl:
public partial class userControls_Blablabla : System.Web.UI.UserControl
{
public List<configItem> ConfigItem {get; set; }
blablabla...rest logic here...
}
public class configItem {
public string Name {get; set;}
public string Url {get; set;}
public string Color {get; set;}
blablabla...rest logic here...
}
How should be done, to be able to do something like that on the .ASPX editor of Visual Studio, and it get recognised by Intellisense?
<User_Control:userControls_Blablabla ID="blablabla" ...blablabla....>
<ConfigItem Name="1" Url="...." Color="..." />
<ConfigItem Name="2" Url="...." Color="..." />
<ConfigItem Name="3" Url="...." Color="..." />
</User_Control:userControls_Blablabla>
Sorry for my english, i know it's not very good.
Thanks in advance!