Gary2397
asked on
Web User Control - ListItemCollection
I am using VS 2005 and VB.net. I have a web user control that I have added a drop down list. I would like to add custom property of list item collection. I would like for the property to display in the properties window on visual studio. I can't seem to get this to work. The property displays, but no elipsis to add items to the collection. Any help?
*************html********************
<table>
<tr>
<td align="right">
Filter where:</td>
<td>
<asp:DropDownList ID="ddlDimFilt" runat="server" AppendDataBoundItems="True">
</asp:DropDownList>
</td>
<td>
<asp:DropDownList ID="ddlDimLimiter" runat="server">
<asp:ListItem Selected="True">Begins with</asp:ListItem>
<asp:ListItem>Contains</asp:ListItem>
<asp:ListItem>is Exactly</asp:ListItem>
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="txtDimFilter" runat="server" ValidationGroup="DimFilter" Width="128px"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvDimFilter" runat="server" ControlToValidate="txtDimFilter"
ErrorMessage="Filter text required" ValidationGroup="DimFilter">*</asp:RequiredFieldValidator>
</td>
<td>
<asp:Button ID="btnDimFilter" runat="server" Text="Filter" ValidationGroup="DimFilter" />
<asp:Button ID="btnDimClear" runat="server" Text="Clear" />
</td>
</tr>
</table>
*************html********************
************code behind snippet**************
Public ReadOnly Property Items() As ListItemCollection
Get
If Me._cItems Is Nothing Then
Me._cItems = New ListItemCollection()
End If
Return Me._cItems
End Get
End Property
Protected Overloads Overrides Sub CreateChildControls()
If Me._cItems Is Nothing Then
Me._cItems = New ListItemCollection()
End If
If _cItems.Count > 0 Then
For Each item As ListItem In _cItems
Me.ddlDimFilt.Items.Add(item)
Next
End If
End Sub
Public Overloads Overrides Sub DataBind()
CreateChildControls()
ChildControlsCreated = True
Me.ddlDimFilt.DataBind()
MyBase.DataBind()
End Sub
************code behind snippet**************
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.