Solved

Web User Control - ListItemCollection

Posted on 2008-06-13
1
664 Views
Last Modified: 2012-06-21
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**************

Open in new window

0
Comment
Question by:Gary2397
1 Comment
 
LVL 16

Accepted Solution

by:
ororiole earned 500 total points
ID: 21789514
User controls will not give you design time editors thru the ellipsis button. For that you would need to create a custom control (derive from webcontrol) and then implement your design time editor, which is s windows form by deriving from one of the UI editor types.

Since your user control includes a rich set of web controls and layout, your best bet is to stick with the user control and do without the collection design time editor.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Populating an array of locale_time_info 8 37
Class object 2 26
Why is some text in blue in Visual Studio? 6 22
IIS Authorization for Web Service 2 19
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now