Getting Started with the ExtendedDropDownList & ExtendedListBox Controls

In order to use our ExtendedDropDownList control, you need to register it on you page as below. The register will register both ExtendedDropDownList and ExtendedListBox controls.

    <%@ Register 
        	Assembly="SharpPieces.Web.Controls.ExtendedDropDownList" 
        	Namespace="SharpPieces.Web.Controls" 
        	TagPrefix="piece" 
    %>

Set the control in your ASPX page. For ExtendedDropDownList, you need the following:

    <piece:ExtendedDropDownList
        	runat="server"
        	id="ExtendedDropDownList1"
    />

For ExtendedListBox, you'll need something like this:

    <piece:ExtendedListBox 
        	runat="server" 
        	id="ExtendedListBox1" 
    />

Next, you'll need to add some items to the control. This method is the same for both ExtendedDropDownList and ExtendedListBox control.

Adding the items from ASPX/ASCX code:

    <ExtendedItems>
        <piece:ExtendedListItem GroupingText="Group 1" Text="My item 1.1" Value="1.1" GroupingType="New" />
        <piece:ExtendedListItem Text="My item 1.2" Value="1.2" GroupingType="inherit" />
        
        <piece:ExtendedListItem GroupingText="Group 2" Text="My item 2.1"  Value="2.1" GroupingType="New" />
        <piece:ExtendedListItem Text="My item 2.2" Value="2.2" GroupingType="inherit" />
    </ExtendedItems>

Adding the items from code-behind code:

    this.listBox.ExtendedItems.Add("Choose an item...");

    this.listBox.ExtendedItems.Add(new ExtendedListItem("Monitor", "12", ListItemGroupingType.New, "Computers"));
    this.listBox.ExtendedItems.Add(new ExtendedListItem("Mouse", "13", ListItemGroupingType.Inherit));
    this.listBox.ExtendedItems.Add(new ExtendedListItem("Keyboard", "14", ListItemGroupingType.Inherit));

    this.listBox.ExtendedItems.Add(new ExtendedListItem("iPhone", "21", true, ListItemGroupingType.New, "Phones"));
    this.listBox.ExtendedItems.Add(new ExtendedListItem("gPhone", "22", ListItemGroupingType.Inherit));
    this.listBox.ExtendedItems.Add(new ExtendedListItem("HTC S730", "23", ListItemGroupingType.Inherit));