Hi all
This problem is doing my head in. I'm venturing into the realm of Custom Web Controls.
I'm creating a control what will contain a number of Objects with a collection property, pretty much like the DropDownList and it's ListItem collection, or the Table and it's TableRow collection (and so on)
The problem is, how do you get the designer to generate the code for the items in the collection?
Example (Using a DropDownList):
When you add items to the collection, the page generates the collection of objects.Code:<asp: DropDownList id="cDurationUnits" runat="server"> <asp:ListItem Value="Hours">Hours</asp:ListItem> <asp:ListItem Value="Days">Days</asp:ListItem> <asp:ListItem Value="Weeks">Weeks</asp:ListItem> <asp:ListItem Value="Months">Months</asp:ListItem> </asp: DropDownList>
When I add objects to my Controls Collection Property, I get this (for example)
Does anyone know how to get the IDE to generate the collection into controls properly (if that makes sense). I've trauled the net looking for an answer but I cannot find it. All the examples I find on Web Custom Controls don't touch on this area.Code:<cc1:MyControl id="myCustomControl" runat="server" ItemCollection="(Collection)"></cc1:MyControl>
Thanks in advance.




Reply With Quote