ComponentOne ComboBox for ASP.NET: ComboBox for ASP.NET AJAX Task-Based Help > Changing the C1ComboBox Selection Mode

Changing the C1ComboBox Selection Mode

C1ComboBox provide two different selection modes, Single mode (default) and Mulitple mode, so you can allow users to select one or several items in the drop-down list. Use the SelectionMode property to set the selection mode.

Setting the selection mode in Design View

1.   Right-click the C1ComboBox control and select Properties from the context menu.

2.   In the Visual Studio Properties window, click the drop-down arrow next to the SelectionMode property and choose Single or Multiple.

Setting the selection mode programmatically

Add the following code to your form:

      Visual Basic

' add the Imports statement at the top of the form

Imports C1.Web.UI.Controls.C1ComboBox;

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        C1ComboBox1.SelectionMode = C1ComboBoxSelectionMode.Multiple

End Sub

      C#

// add the using statement at the top of the form

using C1.Web.UI.Controls.C1ComboBox;

 

protected void Page_Load(object sender, EventArgs e)

    {

        C1ComboBox1.SelectionMode = C1ComboBoxSelectionMode.Multiple;

    }

If the selection mode is set to Multiple, users can use the CTRL button and make multiple selections in the C1ComboBox drop-down list at run time.


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.